chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9946996
)
hashmap: make hashmap_clear() work on NULL hashmaps
author
Lennart Poettering
<lennart@poettering.net>
Tue, 3 Jul 2012 14:15:57 +0000
(16:15 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Tue, 3 Jul 2012 14:15:57 +0000
(16:15 +0200)
src/shared/hashmap.c
patch
|
blob
|
history
diff --git
a/src/shared/hashmap.c
b/src/shared/hashmap.c
index ab00957306e9fb2fdb2d8e1b0e63263368973e07..e2395d4d4290caab9eb1e5a2024ba7fb294d1324 100644
(file)
--- a/
src/shared/hashmap.c
+++ b/
src/shared/hashmap.c
@@
-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);