summaryrefslogtreecommitdiff
path: root/src/basic/hashmap.c
diff options
context:
space:
mode:
authorFelipe Sateler <fsateler@debian.org>2019-02-20 21:24:33 -0300
committerFelipe Sateler <fsateler@debian.org>2019-02-20 21:24:33 -0300
commit7c20daf69c4411979b7f8902f3601d1cdc56cc07 (patch)
treed59b9989ce55ed23693e80974d94c856f1c2c8b1 /src/basic/hashmap.c
parent6e866b331d7cd4a5e0759dd160dea6edabd3678e (diff)
downloadsystemd-upstream/241.tar.gz
New upstream version 241upstream/241
Diffstat (limited to 'src/basic/hashmap.c')
-rw-r--r--src/basic/hashmap.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index 5a4bb37b82..66e9e0046b 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -345,7 +345,7 @@ static unsigned base_bucket_hash(HashmapBase *h, const void *p) {
}
#define bucket_hash(h, p) base_bucket_hash(HASHMAP_BASE(h), p)
-static inline void base_set_dirty(HashmapBase *h) {
+static void base_set_dirty(HashmapBase *h) {
h->dirty = true;
}
#define hashmap_set_dirty(h) base_set_dirty(HASHMAP_BASE(h))
@@ -888,7 +888,8 @@ void internal_hashmap_clear(HashmapBase *h, free_func_t default_free_key, free_f
* themselves from our hash table a second time, the entry is already gone. */
while (internal_hashmap_size(h) > 0) {
- void *v, *k;
+ void *k = NULL;
+ void *v;
v = internal_hashmap_first_key_and_value(h, true, &k);
@@ -1515,8 +1516,11 @@ void *internal_hashmap_first_key_and_value(HashmapBase *h, bool remove, void **r
unsigned idx;
idx = find_first_entry(h);
- if (idx == IDX_NIL)
+ if (idx == IDX_NIL) {
+ if (ret_key)
+ *ret_key = NULL;
return NULL;
+ }
e = bucket_at(h, idx);
key = (void*) e->key;