X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Fshared%2Fhashmap.c;h=73937ac217358ee42e01edbeb27d43456dd5688d;hb=99e651c2dc93fcc0ce762e7dab2dd3e9a70d76a1;hp=48d75023918afadc54df0bf7597a9d38d79f485f;hpb=322e94abd97bbd3b8b0d37719449c0be5b9d99d8;p=elogind.git diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c index 48d750239..73937ac21 100644 --- a/src/shared/hashmap.c +++ b/src/shared/hashmap.c @@ -865,38 +865,41 @@ static void hashmap_free_no_clear(HashmapBase *h) { free(h); } -void internal_hashmap_free(HashmapBase *h) { +HashmapBase *internal_hashmap_free(HashmapBase *h) { /* Free the hashmap, but nothing in it */ - if (!h) - return; + if (h) { + internal_hashmap_clear(h); + hashmap_free_no_clear(h); + } - internal_hashmap_clear(h); - hashmap_free_no_clear(h); + return NULL; } -void internal_hashmap_free_free(HashmapBase *h) { +HashmapBase *internal_hashmap_free_free(HashmapBase *h) { /* Free the hashmap and all data objects in it, but not the * keys */ - if (!h) - return; + if (h) { + internal_hashmap_clear_free(h); + hashmap_free_no_clear(h); + } - internal_hashmap_clear_free(h); - hashmap_free_no_clear(h); + return NULL; } -void hashmap_free_free_free(Hashmap *h) { +Hashmap *hashmap_free_free_free(Hashmap *h) { /* Free the hashmap and all data and key objects in it */ - if (!h) - return; + if (h) { + hashmap_clear_free_free(h); + hashmap_free_no_clear(HASHMAP_BASE(h)); + } - hashmap_clear_free_free(h); - hashmap_free_no_clear(HASHMAP_BASE(h)); + return NULL; } void internal_hashmap_clear(HashmapBase *h) {