chiark / gitweb /
journal: add ability to list values a specified field can take in all entries of...
[elogind.git] / src / shared / hashmap.c
index eb5c549e404a9ce80e08fed07f5a2f56dc2f97ca..26a4eff07fb3b7336d95e585e3e6bd338bdbd4e2 100644 (file)
@@ -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;
+}