@@ -21,6 +21,9 @@ that the hashmap is initialized. It may also be useful for statistical purposes
21
21
`cmpfn` stores the comparison function specified in `hashmap_init()`. In
22
22
advanced scenarios, it may be useful to change this, e.g. to switch between
23
23
case-sensitive and case-insensitive lookup.
24
+ +
25
+ When `disallow_rehash` is set, automatic rehashes are prevented during inserts
26
+ and deletes.
24
27
25
28
`struct hashmap_entry`::
26
29
@@ -57,6 +60,7 @@ Functions
57
60
`unsigned int strihash(const char *buf)`::
58
61
`unsigned int memhash(const void *buf, size_t len)`::
59
62
`unsigned int memihash(const void *buf, size_t len)`::
63
+ `unsigned int memihash_cont(unsigned int hash_seed, const void *buf, size_t len)`::
60
64
61
65
Ready-to-use hash functions for strings, using the FNV-1 algorithm (see
62
66
http://www.isthe.com/chongo/tech/comp/fnv).
@@ -65,6 +69,9 @@ Functions
65
69
`memihash` operate on arbitrary-length memory.
66
70
+
67
71
`strihash` and `memihash` are case insensitive versions.
72
+ +
73
+ `memihash_cont` is a variant of `memihash` that allows a computation to be
74
+ continued with another chunk of data.
68
75
69
76
`unsigned int sha1hash(const unsigned char *sha1)`::
70
77
@@ -184,6 +191,21 @@ passed to `hashmap_cmp_fn` to decide whether the entry matches the key.
184
191
+
185
192
Returns the removed entry, or NULL if not found.
186
193
194
+ `void hashmap_disallow_rehash(struct hashmap *map, unsigned value)`::
195
+
196
+ Disallow/allow automatic rehashing of the hashmap during inserts
197
+ and deletes.
198
+ +
199
+ This is useful if the caller knows that the hashmap will be accessed
200
+ by multiple threads.
201
+ +
202
+ The caller is still responsible for any necessary locking; this simply
203
+ prevents unexpected rehashing. The caller is also responsible for properly
204
+ sizing the initial hashmap to ensure good performance.
205
+ +
206
+ A call to allow rehashing does not force a rehash; that might happen
207
+ with the next insert or delete.
208
+
187
209
`void hashmap_iter_init(struct hashmap *map, struct hashmap_iter *iter)`::
188
210
`void *hashmap_iter_next(struct hashmap_iter *iter)`::
189
211
`void *hashmap_iter_first(struct hashmap *map, struct hashmap_iter *iter)`::
0 commit comments