MapInit
Description
Initialize a map with required key hash and compare callbacks plus a user-owned allocator. Uses linear probing. Allocator argument is optional inside a Scope block.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Foreach.c:140:
IntGraph graph = GraphInit(&alloc);
CountMap counts = MapInit(node_id_hash, node_id_compare, &alloc);
GraphNodeId a = GraphAddNodeR(&graph, 1);- In
Compare.c:221:
DefaultAllocator alloc = DefaultAllocatorInit();
Map(Float, u64) counts = MapInit(float_hash, float_compare, &alloc);
Float k1 = FloatFromStr("3.14", &alloc.base);- In
Compare.c:1037:
Allocator *base = ALLOCATOR_OF(&alloc);
Map(BitVec, u64) counts = MapInit(bitvec_hash, bitvec_compare, &alloc);
BitVec k1 = BitVecInit(base);- In
Compare.c:161:
DefaultAllocator alloc = DefaultAllocatorInit();
Map(Int, u64) counts = MapInit(int_hash, int_compare, &alloc);
Int k1 = IntFrom(100u, &alloc.base);- In
Ops.c:169:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapEmpty(&map);- In
Ops.c:270:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int threshold = 30;- In
Init.c:58:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
size reserved_capacity;- In
Init.c:85:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
for (int i = 0; i < 24; i++) {- In
Init.c:142:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
// Fresh MapInit installs the linear policy by value and starts with
- In
Init.c:161:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result;
int i;- In
Init.c:187:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Init.c:253:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
enum {- In
Insert.c:342:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Insert.c:393:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
// Miss on an empty (capacity 0) map: returns false, nothing inserted.
- In
Insert.c:446:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int key = 42;
int value = 84;- In
Insert.c:468:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int key = 42;
int value = 84;- In
Insert.c:490:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int key = 11;
int value = 110;- In
Insert.c:513:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int value = 110;- In
Insert.c:544:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = true;- In
Insert.c:573:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int *value_ptr;
bool result;- In
Insert.c:598:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int *value_ptr = MapEnsurePtr(&map, 3, 30);- In
Insert.c:622:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int k1 = 1;
int v1 = 10;- In
Insert.c:714:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Insert.c:733:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapCompact(&map); // empty map: must succeed via fast path
- In
Insert.c:751:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapCompact(&map);- In
Insert.c:765:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapCompact(&map);- In
Insert.c:781:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapCompact(&map);- In
Insert.c:798:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Insert.c:825:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
for (int k = 0; k < 10; k++)- In
Insert.c:844:
DefaultAllocator inner = DefaultAllocatorInit();
FailAlloc fa = fail_alloc_init(&inner);
IntIntMap map = MapInit(i32_hash, i32_compare, &fa.base);
for (int k = 0; k < 6; k++)- In
Insert.c:928:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = true;- In
Insert.c:975:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 7, 70);- In
Insert.c:1089:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
for (int k = 0; k < 7; k++)- In
Insert.c:1109:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
for (int k = 0; k < 5; k++)- In
Insert.c:1134:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
for (int k = 0; k < 6; k++)- In
Type.c:59:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapPairCount(&map) == 0 && MapCapacity(&map) == 0 && MapTombstones(&map) == 0 &&- In
Deadend.c:69:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Deadend.c:136:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
GENERIC_MAP(&map)->__magic ^= 0x1;- In
Deadend.c:155:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapContainsPair(&map, 1, 10);- In
Deadend.c:169:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapRemovePair(&map, 1, 10);- In
Deadend.c:183:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapRemoveIf(&map, NULL, NULL);- In
Deadend.c:197:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapRetainIf(&map, NULL, NULL);- In
Deadend.c:481:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Deadend.c:501:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10); // capacity becomes 8
- In
Deadend.c:696:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = MapInsertR(&map, 7, 70); // first ops clear the validated bit
- In
Remove.c:37:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapSetOnlyR(&map, 1, 10);- In
Remove.c:65:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Remove.c:159:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 5, 50);- In
Remove.c:185:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
bool result = (MapRetainIf(&map, always_retain, NULL) == 0);- In
Remove.c:201:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
size removed = MapRemoveIf(&map, always_true_predicate, NULL);- In
Remove.c:214:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Remove.c:236:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 5, 50);- In
Remove.c:259:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 5, 50);- In
Remove.c:293:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
for (int i = 0; i < 12; i++)- In
Remove.c:378:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(const_hash, i32_compare, &alloc);
// Four keys colliding into one bucket form a single probe chain.
- In
Foreach.c:24:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int key_sum = 0;
int value_sum = 0;- In
Foreach.c:48:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int unique_key_sum = 0;
int all_value_sum = 0;- In
Foreach.c:90:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int key_sum = 0;
int value_sum = 0;- In
Foreach.c:127:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapInsertR(&map, 1, 10);- In
Foreach.c:159:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
int n = 0;- In
Access.c:171:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapSetOnlyR(&map, 11, 110);- In
Access.c:248:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapSetOnlyR(&map, 11, 110);- In
Access.c:267:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapValueCursor cursor = MapValueCursorInvalid();
int value_sum = 0;- In
Access.c:314:
typedef Map(int, int) IntIntMap;
DefaultAllocator alloc = DefaultAllocatorInit();
IntIntMap map = MapInit(i32_hash, i32_compare, &alloc);
MapValueCursor cursor = MapValueCursorInvalid();
Last updated on