summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/hashmap.c22
-rw-r--r--src/shared/hashmap.h2
2 files changed, 24 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;
+}
diff --git a/src/shared/hashmap.h b/src/shared/hashmap.h
index 504f0b7637..ed41817dda 100644
--- a/src/shared/hashmap.h
+++ b/src/shared/hashmap.h
@@ -79,6 +79,8 @@ void* hashmap_first(Hashmap *h);
void* hashmap_first_key(Hashmap *h);
void* hashmap_last(Hashmap *h);
+void *hashmap_next(Hashmap *h, const void *key);
+
char **hashmap_get_strv(Hashmap *h);
#define HASHMAP_FOREACH(e, h, i) \