chiark / gitweb /
first try at implementing job creation
[elogind.git] / hashmap.h
index 4c946e35b9d53972df6f3bef996a1f0b39b34a99..91d8b46dba05aaec9699820b4f1de205b655960a 100644 (file)
--- a/hashmap.h
+++ b/hashmap.h
@@ -22,18 +22,22 @@ unsigned trivial_hash_func(const void *p);
 int trivial_compare_func(const void *a, const void *b);
 
 Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
-void hashmap_free(Hashmap*);
+void hashmap_free(Hashmap *h);
+Hashmap *hashmap_copy(Hashmap *h);
 
 int hashmap_put(Hashmap *h, const void *key, void *value);
 void* hashmap_get(Hashmap *h, const void *key);
 void* hashmap_remove(Hashmap *h, const void *key);
 
+int hashmap_merge(Hashmap *h, Hashmap *other);
+
 unsigned hashmap_size(Hashmap *h);
 bool hashmap_isempty(Hashmap *h);
 
 void *hashmap_iterate(Hashmap *h, void **state, const void **key);
 void *hashmap_iterate_backwards(Hashmap *h, void **state, const void **key);
 
+void hashmap_clear(Hashmap *h);
 void *hashmap_steal_first(Hashmap *h);
 void* hashmap_first(Hashmap *h);
 void* hashmap_last(Hashmap *h);
@@ -41,6 +45,9 @@ void* hashmap_last(Hashmap *h);
 #define HASHMAP_FOREACH(e, h, state) \
         for ((state) = NULL, (e) = hashmap_iterate((h), &(state), NULL); (e); (e) = hashmap_iterate((h), &(state), NULL))
 
+#define HASHMAP_FOREACH_KEY(e, k, h, state) \
+        for ((state) = NULL, (e) = hashmap_iterate((h), &(state), (const void**) &(k)); (e); (e) = hashmap_iterate((h), &(state), (const void**) &(k)))
+
 #define HASHMAP_FOREACH_BACKWARDS(e, h, state) \
         for ((state) = NULL, (e) = hashmap_iterate_backwards((h), &(state), NULL); (e); (e) = hashmap_iterate_backwards((h), &(state), NULL))