1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

hashmap: make hashmap_clear() work on NULL hashmaps

This commit is contained in:
Lennart Poettering 2012-07-03 16:15:57 +02:00
parent 9946996cda
commit 61b1477c81

View File

@ -277,6 +277,9 @@ void hashmap_free(Hashmap*h) {
}
void hashmap_free_free(Hashmap *h) {
if (!h)
return;
hashmap_clear_free(h);
hashmap_free(h);
}
@ -292,7 +295,8 @@ void hashmap_clear(Hashmap *h) {
void hashmap_clear_free(Hashmap *h) {
void *p;
assert(h);
if (!h)
return;
while ((p = hashmap_steal_first(h)))
free(p);