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:
parent
9946996cda
commit
61b1477c81
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user