MapGetFirstPtr
Description
Get pointer to the first value stored for a key.
Parameters
| Name | Direction | Description |
|---|---|---|
m |
in,out | Map. |
lookup_key |
in | Key to search for. |
Success
Returns a pointer of type MAP_VALUE_TYPE(m) * to the value slot of the first matching entry. The map is not modified. The pointer is valid until the next rehash.
Failure
Returns NULL when no entry exists for the key. The map is not modified.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Debug.c:313:
return 0;
DebugRecord *live_rec = MapGetFirstPtr(&self->live, ptr);
if (!live_rec) {- In
Debug.c:434:
// the copy. If ptr is not in the live map, forward to deallocate
// which emits the double-free / foreign-ptr diagnostic and aborts.
DebugRecord *rec = MapGetFirstPtr(&self->live, ptr);
if (!rec) {
debug_allocator_deallocate(self, ptr); // aborts
- In
KvConfig.c:338:
return NULL;
}
return MapGetFirstPtr(cfg, *key);
}- In
AllocDebug.c:155:
// to DebugAllocator with no public accessor; reach in to confirm the
// alloc-trace was captured.
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
ok = ok && (rec != NULL) && (rec->alloc_trace_n > 0);- In
AllocDebug.c:374:
// intentional bypass: live map / freed Vec are internal, no accessor.
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
u32 live_n = ok ? rec->alloc_trace_n : 0;
ok = ok && (live_n > 0) && (live_n <= DEBUG_ALLOCATOR_MAX_TRACE);- In
AllocDebug.c:399:
bool ok = (p != NULL);
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
u32 n = ok ? rec->alloc_trace_n : 0;
StackFrame snapshot[DEBUG_ALLOCATOR_MAX_TRACE];- In
AllocDebug.c:786:
bool ok = (p != NULL);
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
ok = ok && (rec != NULL);
ok = ok && (rec->alloc_trace_n > 0);- In
AllocDebug.c:809:
bool ok = (p != NULL);
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
ok = ok && (rec != NULL);
ok = ok && (rec->alloc_trace_n > 0);- In
AllocDebug.c:835:
bool ok = (p != NULL);
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
ok = ok && (rec != NULL);
ok = ok && (rec->alloc_trace_n > 0);- In
AllocDebug.c:918:
// must find each one; a broken hash would miss some).
for (u32 i = 0; i < N; i++) {
DebugRecord *rec = MapGetFirstPtr(&dbg.live, ps[i]);
ok = ok && (rec != NULL);
ok = ok && (rec->requested_size == (size)(8 + (i & 31))); // captured frame count; reach in to require >= 2 frames so "#1" must
// appear in a faithful render.
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
ok = ok && (rec != NULL) && (rec->alloc_trace_n >= 2);
// intentional bypass: snapshot the live record's frame count.
DebugRecord *rec = MapGetFirstPtr(&dbg.live, p);
ok = ok && (rec != NULL) && (rec->alloc_trace_n >= 1);
u32 n = ok ? rec->alloc_trace_n : 0;- In
Foreach.c:67:
static bool city_reachable(CityGraph *graph, CityIndex *index, const Str *from, const Str *to) {
GraphNodeId *from_id = MapGetFirstPtr(index, *from);
GraphNodeId *to_id = MapGetFirstPtr(index, *to);- In
Foreach.c:68:
static bool city_reachable(CityGraph *graph, CityIndex *index, const Str *from, const Str *to) {
GraphNodeId *from_id = MapGetFirstPtr(index, *from);
GraphNodeId *to_id = MapGetFirstPtr(index, *to);
if (!from_id || !to_id) {- In
Foreach.c:160:
}
bool result = *MapGetFirstPtr(&counts, a) == 0;
result = result && *MapGetFirstPtr(&counts, b) == 1;
result = result && *MapGetFirstPtr(&counts, c) == 1;- In
Foreach.c:161:
bool result = *MapGetFirstPtr(&counts, a) == 0;
result = result && *MapGetFirstPtr(&counts, b) == 1;
result = result && *MapGetFirstPtr(&counts, c) == 1;
result = result && *MapGetFirstPtr(&counts, d) == 2;- In
Foreach.c:162:
bool result = *MapGetFirstPtr(&counts, a) == 0;
result = result && *MapGetFirstPtr(&counts, b) == 1;
result = result && *MapGetFirstPtr(&counts, c) == 1;
result = result && *MapGetFirstPtr(&counts, d) == 2;- In
Foreach.c:163:
result = result && *MapGetFirstPtr(&counts, b) == 1;
result = result && *MapGetFirstPtr(&counts, c) == 1;
result = result && *MapGetFirstPtr(&counts, d) == 2;
MapDeinit(&counts);- In
Compare.c:229:
Float probe = FloatFromStr("314e-2", &alloc.base); // same value as k1
u64 *got = MapGetFirstPtr(&counts, probe);
Float missing = FloatFromStr("9.99", &alloc.base);
u64 *gone = MapGetFirstPtr(&counts, missing);- In
Compare.c:231:
u64 *got = MapGetFirstPtr(&counts, probe);
Float missing = FloatFromStr("9.99", &alloc.base);
u64 *gone = MapGetFirstPtr(&counts, missing);
bool result = (got != NULL && *got == 1u);- In
Compare.c:1056:
BitVecPush(&probe, true);
u64 *got = MapGetFirstPtr(&counts, probe);
BitVec missing = BitVecInit(base);- In
Compare.c:1061:
BitVecPush(&missing, true);
BitVecPush(&missing, true);
u64 *gone = MapGetFirstPtr(&counts, missing);
bool result = (got != NULL && *got == 1u);- In
Compare.c:171:
Int probe = IntFrom(100u, &alloc.base);
u64 *got = MapGetFirstPtr(&counts, probe);
Int missing = IntFrom(999u, &alloc.base);
u64 *gone = MapGetFirstPtr(&counts, missing);- In
Compare.c:173:
u64 *got = MapGetFirstPtr(&counts, probe);
Int missing = IntFrom(999u, &alloc.base);
u64 *gone = MapGetFirstPtr(&counts, missing);
bool result = (got != NULL && *got == 1u);- In
Ops.c:63:
result = result && !MapContainsKey(&map, key);
result = result && (MapValueCountForKey(&map, "alpha") == 2);
stored_value = MapGetFirstPtr(&map, "alpha");
result = result && stored_value && (*stored_value != value) && (ZstrCompare(*stored_value, "first") == 0);
MapForeachValueForKey(&map, "alpha", entry_value) {- In
Ops.c:103:
(MapPolicy(&map).should_rehash == MapPolicyQuadratic.should_rehash);
result = result && (MapValueCountForKey(&map, "red") == 2);
result = result && MapGetFirstPtr(&map, "red") && (ZstrCompare(*MapGetFirstPtr(&map, "red"), "apple") == 0);
result = result && MapGetFirstPtr(&map, "yellow") && (ZstrCompare(*MapGetFirstPtr(&map, "yellow"), "banana") == 0);
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);- In
Ops.c:104:
result = result && (MapValueCountForKey(&map, "red") == 2);
result = result && MapGetFirstPtr(&map, "red") && (ZstrCompare(*MapGetFirstPtr(&map, "red"), "apple") == 0);
result = result && MapGetFirstPtr(&map, "yellow") && (ZstrCompare(*MapGetFirstPtr(&map, "yellow"), "banana") == 0);
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);
MapForeachValueForKey(&map, "red", red_value) {- In
Ops.c:105:
result = result && MapGetFirstPtr(&map, "red") && (ZstrCompare(*MapGetFirstPtr(&map, "red"), "apple") == 0);
result = result && MapGetFirstPtr(&map, "yellow") && (ZstrCompare(*MapGetFirstPtr(&map, "yellow"), "banana") == 0);
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);
MapForeachValueForKey(&map, "red", red_value) {
if ((ZstrCompare(red_value, "apple") == 0) || (ZstrCompare(red_value, "cherry") == 0)) {- In
Ops.c:307:
MapInsertR(&map, 0, 999);
int *v = MapGetFirstPtr(&map, 0);
bool result = v && (*v == 999);
result = result && (MapValueCountForKey(&map, 0) == 1);- In
Init.c:75:
MapSetOnlyR(&map, 7, 70);
result = result && (MapPairCount(&map) == 1) && (MapValueCountForKey(&map, 7) == 1);
result = result && MapGetFirstPtr(&map, 7) && (*MapGetFirstPtr(&map, 7) == 70);
MapDeinit(&map);- In
Init.c:99:
for (int i = 0; i < 24; i++) {
int *value = MapGetFirstPtr(&map, i);
result = result && value && (*value == i * 10);
}- In
Init.c:130:
for (int i = 0; i < 6; i++) {
int *value = MapGetFirstPtr(&map, i);
result = result && value && (*value == (i + 100));
}- In
Init.c:175:
for (i = 0; i < 8; i++) {
int *value = MapGetFirstPtr(&map, i);
result = result && value && (*value == i * 100);
}- In
Init.c:194:
bool result = (MapCapacity(&map) >= 48) && (MapPairCount(&map) == 2);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 20);- In
Init.c:195:
bool result = (MapCapacity(&map) >= 48) && (MapPairCount(&map) == 2);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 20);
MapDeinit(&map);- In
Init.c:211:
bool result = (MapKeyHash(&map) == i32_hash) && (MapKeyCompare(&map) == i32_compare) && (MapPairCount(&map) == 2);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 50);
result = result && MapGetFirstPtr(&map, 6) && (*MapGetFirstPtr(&map, 6) == 60);- In
Init.c:212:
bool result = (MapKeyHash(&map) == i32_hash) && (MapKeyCompare(&map) == i32_compare) && (MapPairCount(&map) == 2);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 50);
result = result && MapGetFirstPtr(&map, 6) && (*MapGetFirstPtr(&map, 6) == 60);
MapDeinit(&map);- In
Init.c:238:
MapInsertR(&map, "alpha", "first");
result = result && (MapPairCount(&map) == 1);
result = result && MapGetFirstPtr(&map, "alpha") && (ZstrCompare(*MapGetFirstPtr(&map, "alpha"), "first") == 0);
MapDeinit(&map);- In
Init.c:263:
bool result = (MapPairCount(&map) == N);
for (int i = 0; i < N; i++) {
int *value = MapGetFirstPtr(&map, i);
result = result && value && (*value == i * 7 + 1);
}- In
Insert.c:354:
result = result && (MapValueCountForKey(&map, 2) == 1);
result = result && (MapValueCountForKey(&map, 3) == 1);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 200);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);- In
Insert.c:355:
result = result && (MapValueCountForKey(&map, 3) == 1);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 200);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);- In
Insert.c:356:
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 200);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);
MapDeinit(&map);- In
Insert.c:375:
bool result = (MapPairCount(&map) == 3);
result = result && (MapValueCountForKey(&map, 1) == 3);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 100);
result = result && MapContainsPair(&map, 1, 11);
result = result && MapContainsPair(&map, 1, 12);- In
Insert.c:407:
result = result && (MapPairCount(&map) == 1);
// Pre-existing entry is untouched.
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
MapDeinit(&map);- In
Insert.c:431:
result = result && (MapValueCountForKey(&map, 5) == 1);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 500);
result = result && MapContainsPair(&map, 5, 500);
result = result && !MapContainsPair(&map, 5, 50);- In
Insert.c:454:
bool result = (key == 0) && (value == 0);
result = result && (MapValueCountForKey(&map, 42) == 1);
result = result && MapGetFirstPtr(&map, 42) && (*MapGetFirstPtr(&map, 42) == 84);
MapDeinit(&map);- In
Insert.c:476:
bool result = (key == 42) && (value == 84);
result = result && (MapValueCountForKey(&map, 42) == 1);
result = result && MapGetFirstPtr(&map, 42) && (*MapGetFirstPtr(&map, 42) == 84);
MapDeinit(&map);- In
Insert.c:498:
bool result = (key == 0) && (value == 0);
result = result && (MapValueCountForKey(&map, 11) == 1);
result = result && MapGetFirstPtr(&map, 11) && (*MapGetFirstPtr(&map, 11) == 110);
MapDeinit(&map);- In
Insert.c:522:
result = result && (value == 0);
result = result && (MapValueCountForKey(&map, 11) == 1);
result = result && MapGetFirstPtr(&map, 11) && (*MapGetFirstPtr(&map, 11) == 110);
// Miss path: returns false, value source NOT zeroed, nothing inserted.
- In
Insert.c:605:
*value_ptr = 333; // mutate through the returned pointer
int *refetched = MapGetFirstPtr(&map, 3);
result = result && refetched && (*refetched == 333);
// Mutation must not have spawned a second entry.
- In
Insert.c:639:
result = result && (k2 == 0) && (v2 == 0);
result = result && (MapValueCountForKey(&map, 1) == 1);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 11);
MapDeinit(&map);- In
Insert.c:671:
// SetFirstR updates the existing first value of key 2 (insert was 20).
MapMustSetFirstR(&map, 2, 222);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 222);
int sf = 333;- In
Insert.c:676:
MapMustSetFirstL(&map, 3, sf); // value zeroed on success
result = result && (sf == 0);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 333);
MapMustSetOnlyR(&map, 4, 40);- In
Insert.c:680:
MapMustSetOnlyR(&map, 4, 40);
result = result && (MapValueCountForKey(&map, 4) == 1);
result = result && MapGetFirstPtr(&map, 4) && (*MapGetFirstPtr(&map, 4) == 40);
int so = 50;- In
Insert.c:687:
result = result && (sk == 0) && (so == 0);
result = result && (MapValueCountForKey(&map, 4) == 1);
result = result && MapGetFirstPtr(&map, 4) && (*MapGetFirstPtr(&map, 4) == 50);
int msk = 5;- In
Insert.c:694:
result = result && (msk == 0) && (msv == 0);
result = result && (MapValueCountForKey(&map, 5) == 1);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 55);
MapDeinit(&map);- In
Insert.c:739:
result = result && (MapPairCount(&map) == 0);
MapInsertR(&map, 5, 50);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 50);
MapDeinit(&map);- In
Insert.c:755:
bool result = MapCompact(&map);
MapInsertR(&map, 7, 70);
result = result && MapGetFirstPtr(&map, 7) && (*MapGetFirstPtr(&map, 7) == 70);
MapDeinit(&map);- In
Insert.c:770:
MapInsertR(&map, 8, 80);
MapInsertR(&map, 9, 90);
result = result && MapGetFirstPtr(&map, 8) && (*MapGetFirstPtr(&map, 8) == 80);
result = result && MapGetFirstPtr(&map, 9) && (*MapGetFirstPtr(&map, 9) == 90);- In
Insert.c:771:
MapInsertR(&map, 9, 90);
result = result && MapGetFirstPtr(&map, 8) && (*MapGetFirstPtr(&map, 8) == 80);
result = result && MapGetFirstPtr(&map, 9) && (*MapGetFirstPtr(&map, 9) == 90);
MapDeinit(&map);- In
Insert.c:785:
bool result = MapCompact(&map);
MapInsertR(&map, 11, 110);
result = result && MapGetFirstPtr(&map, 11) && (*MapGetFirstPtr(&map, 11) == 110);
MapDeinit(&map);- In
Insert.c:808:
result = result && (MapPairCount(&map) == 3);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 20);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);- In
Insert.c:809:
result = result && (MapPairCount(&map) == 3);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 20);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);- In
Insert.c:810:
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 20);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);
MapDeinit(&map);- In
Insert.c:855:
bool result = failed && (MapPairCount(&map) == 6);
for (int k = 0; k < 6; k++)
result = result && MapGetFirstPtr(&map, k) && (*MapGetFirstPtr(&map, k) == k * 10);
MapDeinit(&map);- In
Insert.c:883:
result = result && (MapPairCount(&map) == 6);
for (int i = 0; i < 6; i++)
result = result && MapGetFirstPtr(&map, keys[i]) && (*MapGetFirstPtr(&map, keys[i]) == keys[i] + 1);
MapDeinit(&map);- In
Insert.c:936:
result = result && (MapPairCount(&map) == 6);
for (int k = 0; k < 6; k++) {
int *v = MapGetFirstPtr(&map, k);
result = result && v && (*v == k * 100 + 1);
}- In
Insert.c:962:
result = result && (MapPairCount(&map) == 9);
for (int k = 0; k < 9; k++) {
int *v = MapGetFirstPtr(&map, k);
result = result && v && (*v == k * 100 + 3);
}- In
Insert.c:983:
MapInsertR(&map, 7, 71); // reuses the tombstone slot for key 7
result = result && (MapTombstones(&map) == 0);
result = result && MapGetFirstPtr(&map, 7) && (*MapGetFirstPtr(&map, 7) == 71);
MapDeinit(&map);- In
Insert.c:1043:
bool result = (MapPairCount(&map) == 5);
for (int i = 0; i < 5; i++) {
int *v = MapGetFirstPtr(&map, keys[i]);
result = result && v && (*v == keys[i] + 1);
result = result && MapContainsKey(&map, keys[i]);- In
Insert.c:1120:
result = result && (MapTombstones(&map) == 0);
result = result && MapGetFirstPtr(&map, 200) && (*MapGetFirstPtr(&map, 200) == 200);
MapDeinit(&map);- In
Insert.c:1164:
result = result && (MapPairCount(&map) == 1);
result = result && (MapValueCountForKey(&map, 7) == 1);
result = result && MapGetFirstPtr(&map, 7) && (*MapGetFirstPtr(&map, 7) == 700);
MapDeinit(&map);- In
Insert.c:1193:
result = result && (MapPairCount(&map) == 9);
for (int k = 0; k < 9; k++)
result = result && MapGetFirstPtr(&map, k) && (*MapGetFirstPtr(&map, k) == k * 100 + 3);
MapDeinit(&map);- In
Deadend.c:634:
IntIntMap map = MapInitWithPolicy(i32_hash, i32_compare, policy, &alloc);
bool result = MapInsertR(&map, 1, 10);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 10);
MapDeinit(&map);- In
Deadend.c:699:
bool result = MapInsertR(&map, 7, 70); // first ops clear the validated bit
result = result && MapGetFirstPtr(&map, 7) && (*MapGetFirstPtr(&map, 7) == 70);
// intentional bypass: no public mutator can violate length<=capacity; we
- In
Deadend.c:710:
// A validating read op. Real: bit cleared -> structural skipped -> ok.
// Mutant: always validates -> length>capacity -> LOG_FATAL.
int *v = MapGetFirstPtr(&map, 7);
result = result && (v != NULL) && (*v == 70);- In
Remove.c:48:
result = result && MapContainsKey(&map, 1);
result = result && (MapValueCountForKey(&map, 1) == 1);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 11);
result = result && (MapPairCount(&map) == 2);
// Length shrinks by exactly one.
- In
Remove.c:53:
result = result && (MapPairCount(&map) == length_before - 1);
// Unrelated key untouched.
result = result && MapGetFirstPtr(&map, 2) && (*MapGetFirstPtr(&map, 2) == 20);
MapDeinit(&map);- In
Remove.c:171:
result = result && (MapTombstones(&map) == 0);
result = result && (MapPairCount(&map) == 1);
int *value = MapGetFirstPtr(&map, 5);
result = result && value && (*value == 51);- In
Remove.c:224:
result = result && !MapContainsKey(&map, 2);
result = result && (MapValueCountForKey(&map, 1) == 1);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 11);
result = result && MapContainsKey(&map, 3);
result = result && (MapPairCount(&map) == 2);- In
Remove.c:306:
MapSetOnlyR(&map, 5, 205);
result = result && MapContainsKey(&map, 5);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 205);
result = result && (MapPairCount(&map) == length_before);
// Unrelated keys remain intact.
- In
Remove.c:309:
result = result && (MapPairCount(&map) == length_before);
// Unrelated keys remain intact.
result = result && MapGetFirstPtr(&map, 4) && (*MapGetFirstPtr(&map, 4) == 104);
result = result && MapGetFirstPtr(&map, 11) && (*MapGetFirstPtr(&map, 11) == 111);- In
Remove.c:310:
// Unrelated keys remain intact.
result = result && MapGetFirstPtr(&map, 4) && (*MapGetFirstPtr(&map, 4) == 104);
result = result && MapGetFirstPtr(&map, 11) && (*MapGetFirstPtr(&map, 11) == 111);
MapDeinit(&map);- In
Remove.c:388:
result = result && (MapPairCount(&map) == 2);
result = result && !MapContainsKey(&map, 1) && !MapContainsKey(&map, 2);
result = result && MapGetFirstPtr(&map, 0) && (*MapGetFirstPtr(&map, 0) == 0);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);- In
Remove.c:389:
result = result && !MapContainsKey(&map, 1) && !MapContainsKey(&map, 2);
result = result && MapGetFirstPtr(&map, 0) && (*MapGetFirstPtr(&map, 0) == 0);
result = result && MapGetFirstPtr(&map, 3) && (*MapGetFirstPtr(&map, 3) == 30);
// The chain still accepts new keys, and every live key stays retrievable.
- In
Remove.c:394:
result = result && MapInsertR(&map, 5, 55) && MapInsertR(&map, 6, 66);
result = result && (MapPairCount(&map) == 4);
int *v5 = MapGetFirstPtr(&map, 5);
int *v6 = MapGetFirstPtr(&map, 6);
result = result && v5 && (*v5 == 55) && v6 && (*v6 == 66);- In
Remove.c:395:
result = result && (MapPairCount(&map) == 4);
int *v5 = MapGetFirstPtr(&map, 5);
int *v6 = MapGetFirstPtr(&map, 6);
result = result && v5 && (*v5 == 55) && v6 && (*v6 == 66);
result = result && MapGetFirstPtr(&map, 0) && MapGetFirstPtr(&map, 3);- In
Remove.c:397:
int *v6 = MapGetFirstPtr(&map, 6);
result = result && v5 && (*v5 == 55) && v6 && (*v6 == 66);
result = result && MapGetFirstPtr(&map, 0) && MapGetFirstPtr(&map, 3);
MapDeinit(&map);- In
Access.c:176:
MapInsertR(&map, 11, 111);
int *value = MapGetFirstPtr(&map, 11);
bool result = value && (*value == 110);
result = result && (MapGetFirstPtr(&map, 999) == NULL);- In
Access.c:178:
int *value = MapGetFirstPtr(&map, 11);
bool result = value && (*value == 110);
result = result && (MapGetFirstPtr(&map, 999) == NULL);
MapDeinit(&map);- In
Access.c:196:
MapInsertR(&map, 11, 111);
int *value = MapGetFirstPtr(&map, 11);
bool result = value && (*value == 110);- In
Access.c:202:
if (value)
*value = 999;
int *value_again = MapGetFirstPtr(&map, 11);
result = result && value_again && (*value_again == 999);
result = result && (value == value_again);- In
Access.c:222:
IntIntMap map = MapInitWithValueCompare(i32_hash, i32_compare, i32_compare, &alloc);
bool result = (MapGetFirstPtr(&map, 7) == NULL); // map_get_value_ptr early-out
result = result && !MapContainsKey(&map, 7); // map_contains early-out
result = result && !MapContainsPair(&map, 7, 0); // map_contains_pair early-out
- In
Access.c:331:
bool result = (MapValuePtrFromCursor(&map, cursor) == NULL);
result = result && (MapValueCountForKey(&map, 5) == 1);
result = result && MapGetFirstPtr(&map, 5) && (*MapGetFirstPtr(&map, 5) == 51);
MapDeinit(&map);- In
Access.c:354:
bool result = (MapPairCount(&map) == 8) && (MapUniqueKeyCount(&map) == 8);
for (int k = 0; k < 8; k++) {
int *v = MapGetFirstPtr(&map, k);
result = result && v && (*v == k * 100 + 7);
result = result && MapContainsKey(&map, k) && (MapValueCountForKey(&map, k) == 1);- In
Access.c:359:
}
// A key that collides into the chain but was never inserted is absent.
result = result && !MapContainsKey(&map, 99) && (MapGetFirstPtr(&map, 99) == NULL);
// Multivalued key inside the colliding chain: count is per-key, not
- In
Access.c:403:
// Lookup: every inserted key must return ITS OWN value, not a neighbour's.
for (int k = 0; k < KEY_COUNT; k++) {
int *v = MapGetFirstPtr(&map, k);
result = result && v && (*v == k * 100 + 7);
result = result && MapContainsKey(&map, k) && (MapValueCountForKey(&map, k) == 1);- In
Access.c:408:
}
// A key that collides into the chain but was never inserted is absent.
result = result && !MapContainsKey(&map, 9999) && (MapGetFirstPtr(&map, 9999) == NULL);
// Remove an INTERIOR key from the collision chain.
- In
Access.c:417:
result = result && (MapPairCount(&map) == (KEY_COUNT - 1));
result = result && (MapUniqueKeyCount(&map) == (KEY_COUNT - 1));
result = result && !MapContainsKey(&map, removed) && (MapGetFirstPtr(&map, removed) == NULL);
// Every OTHER key is still reachable with its own value -- removing an
- In
Access.c:424:
if (k == removed)
continue;
int *v = MapGetFirstPtr(&map, k);
result = result && v && (*v == k * 100 + 7);
result = result && MapContainsKey(&map, k) && (MapValueCountForKey(&map, k) == 1);
Last updated on