MapPairCount
Description
Number of stored key/value pairs in the multimap.
Parameters
| Name | Direction | Description |
|---|---|---|
m |
in | Map. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Debug.c:158:
// bytes_in_use is non-zero; conversely zero live entries means
// every byte has been returned.
if (MapPairCount(&self->live) == 0 && self->bytes_in_use != 0) {
LOG_FATAL("DebugAllocator: bytes_in_use {} with no live records", (u64)self->bytes_in_use);
}- In
Debug.c:469:
// Report leaks for anything still in `live`.
if (MapAllocator(&self->live) && MapPairCount(&self->live) > 0) {
LOG_ERROR("DebugAllocator: {} live allocation(s) at deinit time:", (u64)MapPairCount(&self->live));
MapForeachPairPtr(&self->live, key_ptr, val_ptr) {- In
Debug.c:470:
// Report leaks for anything still in `live`.
if (MapAllocator(&self->live) && MapPairCount(&self->live) > 0) {
LOG_ERROR("DebugAllocator: {} live allocation(s) at deinit time:", (u64)MapPairCount(&self->live));
MapForeachPairPtr(&self->live, key_ptr, val_ptr) {
LOG_ERROR(" leaked {x} ({} bytes)", (u64)*key_ptr, (u64)val_ptr->requested_size);- In
Debug.c:508:
if (!self)
return 0;
return (size)MapPairCount(&self->live);
}- In
Debug.c:532:
if (!self || !out)
return;
if (MapPairCount(&self->live) == 0)
return;- In
Debug.c:535:
return;
StrAppendFmt(out, "DebugAllocator: {} live allocation(s):\n", (u64)MapPairCount(&self->live));
MapForeachPairPtr(&self->live, key_ptr, val_ptr) {
StrAppendFmt(out, " leak: {x} ({} bytes)\n", (u64)*key_ptr, (u64)val_ptr->requested_size);- In
Parse.c:24:
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 3);
result = result && KvConfigContains(&cfg, "host");
result = result && host && StrCmp(host, "localhost") == 0;- In
Parse.c:58:
result = result && (StrIterIndex(&si) == StrIterLength(&si));
result = result && (MapPairCount(&cfg) == 4);
result = result && path && StrCmp(path, "/srv/my app") == 0;
result = result && user && StrCmp(user, "root") == 0;- In
Map.Insert.c:32:
MapSetOnlyR(&map, 3, 30);
bool result = MapPairCount(&map) == 4;
result = result && (MapValueCountForKey(&map, 1) == 2);
result = result && (MapValueCountForKey(&map, 2) == 1);- In
Map.Insert.c:55:
MapSetFirstR(&map, 1, 100);
bool result = (MapPairCount(&map) == 3);
result = result && (MapValueCountForKey(&map, 1) == 3);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 100);- In
Map.Insert.c:100:
MapInsertR(&map, i, i * 10);
}
result = result && (MapPairCount(&map) == 600);
// Phase 2: alternating remove+insert at the same churn point. Each
- In
Map.Insert.c:110:
MapInsertR(&map, key, i);
}
result = result && (MapPairCount(&map) >= 600);
MapDeinit(&map);- In
Map.Insert.c:126:
value_ptr = MapEnsurePtr(&map, 8, 80);
result = value_ptr && (*value_ptr == 80);
result = result && (MapPairCount(&map) == 1);
result = result && (MapValueCountForKey(&map, 8) == 1);- In
Map.Insert.c:131:
value_ptr = MapEnsurePtr(&map, 8, 800);
result = result && value_ptr && (*value_ptr == 80);
result = result && (MapPairCount(&map) == 1);
result = result && (MapValueCountForKey(&map, 8) == 1); bool result = (got != NULL && *got == 1u);
result = result && (gone == NULL);
result = result && (MapPairCount(&counts) == 2);
FloatDeinit(&k1);- In
Map.Remove.c:34:
result = result && (MapValueCountForKey(&map, 1) == 1);
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 11);
result = result && (MapPairCount(&map) == 2);
MapDeinit(&map);- In
Map.Remove.c:82:
result = result && MapGetFirstPtr(&map, 1) && (*MapGetFirstPtr(&map, 1) == 11);
result = result && MapContainsKey(&map, 3);
result = result && (MapPairCount(&map) == 2);
MapDeinit(&map);- In
Map.Remove.c:103:
result = result && (MapValueCountForKey(&map, 5) == 0);
result = result && MapContainsKey(&map, 9);
result = result && (MapPairCount(&map) == 1);
MapDeinit(&map); bool result = (got != NULL && *got == 1u);
result = result && (gone == NULL);
result = result && (MapPairCount(&counts) == 2);
IntDeinit(&k1);- In
Map.Init.c:69:
bool result = (reserved_capacity >= 32) && (MapCapacity(&map) == reserved_capacity) && (MapTombstones(&map) == 0) &&
(MapPairCount(&map) == 0) && MapEmpty(&map) && !MapContainsKey(&map, 1) && !MapContainsKey(&map, 2);
MapSetOnlyR(&map, 7, 70);- In
Map.Init.c:72:
MapSetOnlyR(&map, 7, 70);
result = result && (MapPairCount(&map) == 1) && (MapValueCountForKey(&map, 7) == 1);
result = result && MapGetFirstPtr(&map, 7) && (*MapGetFirstPtr(&map, 7) == 70);- In
Map.Init.c:89:
}
MapRehashWithPolicy(&map, MapPairCount(&map), MapPolicyQuadratic);
bool result = (MapPolicy(&map).first_index == MapPolicyQuadratic.first_index) && bool result = (got != NULL && *got == 1u);
result = result && (gone == NULL);
result = result && (MapPairCount(&counts) == 2);
BitVecDeinit(&k1);- In
Map.Ops.c:89:
MapSetOnlyR(&map, "yellow", "banana");
MapSetOnlyR(&map, "green", "pear");
MapRehashWithPolicy(&map, MapPairCount(&map), MapPolicyQuadratic);
bool result = (MapPolicy(&map).first_index == MapPolicyQuadratic.first_index) &&- In
Map.Ops.c:131:
result = result && MapContainsPair(&first, 1, 11);
result = result && MapContainsPair(&first, 2, 20);
result = result && (MapPairCount(&first) == 2);
result = result && (MapUniqueKeyCount(&first) == 2);- In
Map.Ops.c:138:
result = result && MapContainsPair(&first, 9, 90);
result = result && MapContainsPair(&first, 10, 100);
result = result && (MapPairCount(&first) == 2);
result = result && MapContainsPair(&second, 1, 11);
result = result && MapContainsPair(&second, 2, 20);- In
Map.Ops.c:141:
result = result && MapContainsPair(&second, 1, 11);
result = result && MapContainsPair(&second, 2, 20);
result = result && (MapPairCount(&second) == 2);
MapDeinit(&first);- In
Map.Ops.c:172:
result = result && MapContainsKey(&map, 3);
result = result && MapContainsKey(&map, 4);
result = result && (MapPairCount(&map) == 2);
MapDeinit(&map);- In
Map.Type.c:60:
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapPairCount(&map) == 0 && MapCapacity(&map) == 0 && MapTombstones(&map) == 0 &&
MapEntries(&map) == NULL && MapStates(&map) == NULL && MapKeyCompare(&map) == i32_compare &&
MapValueCompare(&map) == NULL && MapKeyHash(&map) == i32_hash &&- In
Ops.h:22:
/// TAGS: Map, Empty, Query, Ops
///
#define MapEmpty(m) (MapPairCount(m) == 0)
///
Last updated on