diff options
Diffstat (limited to 'src/shared/hashmap.c')
-rw-r--r-- | src/shared/hashmap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c index eb5c549e40..26a4eff07f 100644 --- a/src/shared/hashmap.c +++ b/src/shared/hashmap.c @@ -758,3 +758,25 @@ char **hashmap_get_strv(Hashmap *h) { return sv; } + +void *hashmap_next(Hashmap *h, const void *key) { + unsigned hash; + struct hashmap_entry *e; + + assert(h); + assert(key); + + if (!h) + return NULL; + + hash = h->hash_func(key) % NBUCKETS; + e = hash_scan(h, hash, key); + if (!e) + return NULL; + + e = e->iterate_next; + if (!e) + return NULL; + + return e->value; +} |