Lines Matching refs:map

4  * Generic non-thread safe hash map implementation.
83 void hashmap__init(struct hashmap *map, hashmap_hash_fn hash_fn,
88 void hashmap__clear(struct hashmap *map);
89 void hashmap__free(struct hashmap *map);
91 size_t hashmap__size(const struct hashmap *map);
92 size_t hashmap__capacity(const struct hashmap *map);
129 int hashmap_insert(struct hashmap *map, long key, long value,
133 #define hashmap__insert(map, key, value, strategy, old_key, old_value) \
134 hashmap_insert((map), (long)(key), (long)(value), (strategy), \
138 #define hashmap__add(map, key, value) \
139 hashmap__insert((map), (key), (value), HASHMAP_ADD, NULL, NULL)
141 #define hashmap__set(map, key, value, old_key, old_value) \
142 hashmap__insert((map), (key), (value), HASHMAP_SET, (old_key), (old_value))
144 #define hashmap__update(map, key, value, old_key, old_value) \
145 hashmap__insert((map), (key), (value), HASHMAP_UPDATE, (old_key), (old_value))
147 #define hashmap__append(map, key, value) \
148 hashmap__insert((map), (key), (value), HASHMAP_APPEND, NULL, NULL)
150 bool hashmap_delete(struct hashmap *map, long key, long *old_key, long *old_value);
152 #define hashmap__delete(map, key, old_key, old_value) \
153 hashmap_delete((map), (long)(key), \
157 bool hashmap_find(const struct hashmap *map, long key, long *value);
159 #define hashmap__find(map, key, value) \
160 hashmap_find((map), (long)(key), hashmap_cast_ptr(value))
164 * @map: hashmap to iterate
168 #define hashmap__for_each_entry(map, cur, bkt) \
169 for (bkt = 0; bkt < map->cap; bkt++) \
170 for (cur = map->buckets[bkt]; cur; cur = cur->next)
175 * @map: hashmap to iterate
180 #define hashmap__for_each_entry_safe(map, cur, tmp, bkt) \
181 for (bkt = 0; bkt < map->cap; bkt++) \
182 for (cur = map->buckets[bkt]; \
188 * @map: hashmap to iterate
192 #define hashmap__for_each_key_entry(map, cur, _key) \
193 for (cur = map->buckets \
194 ? map->buckets[hash_bits(map->hash_fn((_key), map->ctx), map->cap_bits)] \
198 if (map->equal_fn(cur->key, (_key), map->ctx))
200 #define hashmap__for_each_key_entry_safe(map, cur, tmp, _key) \
201 for (cur = map->buckets \
202 ? map->buckets[hash_bits(map->hash_fn((_key), map->ctx), map->cap_bits)] \
206 if (map->equal_fn(cur->key, (_key), map->ctx))