X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Fhashmap.h;h=b912af8d8f10c2e4d27cebeb155eab6b90bf4f49;hp=3d4f6721bc9efc1b5c32e34576b11658d76765c1;hb=5e2f14e62b43f713bade20dd9f55db525ac43859;hpb=71ebe743a0ddbd4873967c00e20a57287ae12fc3 diff --git a/src/shared/hashmap.h b/src/shared/hashmap.h index 3d4f6721b..b912af8d8 100644 --- a/src/shared/hashmap.h +++ b/src/shared/hashmap.h @@ -24,6 +24,7 @@ #include #include "macro.h" +#include "util.h" /* Pretty straightforward hash table implementation. As a minor * optimization a NULL hashmap object will be treated as empty hashmap @@ -104,3 +105,10 @@ char **hashmap_get_strv(Hashmap *h); #define HASHMAP_FOREACH_BACKWARDS(e, h, i) \ for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (e); (e) = hashmap_iterate_backwards((h), &(i), NULL)) + +DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, hashmap_free); +DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, hashmap_free_free); +DEFINE_TRIVIAL_CLEANUP_FUNC(Hashmap*, hashmap_free_free_free); +#define _cleanup_hashmap_free_ _cleanup_(hashmap_freep) +#define _cleanup_hashmap_free_free_ _cleanup_(hashmap_free_freep) +#define _cleanup_hashmap_free_free_free_ _cleanup_(hashmap_free_free_freep)