chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
shared: add formats-util.h
[elogind.git]
/
src
/
shared
/
hashmap.c
diff --git
a/src/shared/hashmap.c
b/src/shared/hashmap.c
index e63ba4bb5aa84d7eebe7770c0bcbb0daae538daa..73937ac217358ee42e01edbeb27d43456dd5688d 100644
(file)
--- a/
src/shared/hashmap.c
+++ b/
src/shared/hashmap.c
@@
-20,9
+20,7
@@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <assert.h>
#include <stdlib.h>
#include <stdlib.h>
-#include <string.h>
#include <errno.h>
#include "util.h"
#include <errno.h>
#include "util.h"
@@
-31,9
+29,12
@@
#include "macro.h"
#include "siphash24.h"
#include "strv.h"
#include "macro.h"
#include "siphash24.h"
#include "strv.h"
-#include "list.h"
#include "mempool.h"
#include "mempool.h"
+#ifdef ENABLE_DEBUG_HASHMAP
+#include "list.h"
+#endif
+
/*
* Implementation of hashmaps.
* Addressing: open
/*
* Implementation of hashmaps.
* Addressing: open
@@
-864,38
+865,41
@@
static void hashmap_free_no_clear(HashmapBase *h) {
free(h);
}
free(h);
}
-
void
internal_hashmap_free(HashmapBase *h) {
+
HashmapBase *
internal_hashmap_free(HashmapBase *h) {
/* Free the hashmap, but nothing in it */
/* 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 */
/* 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 */
/* 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) {
}
void internal_hashmap_clear(HashmapBase *h) {