X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fhashmap.h;h=16ffbd392216e77a126ef1d8ef0d0877470c49b7;hp=3ff3efe8d158c694bc64a25ddc6e80a801d0f859;hb=99e68c0b2d6ca9d491036920fcbca4c8d54404a8;hpb=e99e38bbdcca3fe5956823bdb3d38544ccf93221 diff --git a/src/hashmap.h b/src/hashmap.h index 3ff3efe8d..16ffbd392 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -1,4 +1,4 @@ -/*-*- Mode: C; c-basic-offset: 8 -*-*/ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ #ifndef foohashmaphfoo #define foohashmaphfoo @@ -47,6 +47,7 @@ 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 *h); +void hashmap_free_free(Hashmap *h); Hashmap *hashmap_copy(Hashmap *h); int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func); @@ -56,6 +57,7 @@ void* hashmap_get(Hashmap *h, const void *key); void* hashmap_remove(Hashmap *h, const void *key); void* hashmap_remove_value(Hashmap *h, const void *key, void *value); int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value); +int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value); int hashmap_merge(Hashmap *h, Hashmap *other); void hashmap_move(Hashmap *h, Hashmap *other); @@ -70,9 +72,12 @@ void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i); void hashmap_clear(Hashmap *h); void *hashmap_steal_first(Hashmap *h); +void *hashmap_steal_first_key(Hashmap *h); void* hashmap_first(Hashmap *h); void* hashmap_last(Hashmap *h); +char **hashmap_get_strv(Hashmap *h); + #define HASHMAP_FOREACH(e, h, i) \ for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); (e); (e) = hashmap_iterate((h), &(i), NULL))