chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sd-bus: fix parsing of KDBUS_CMD_LIST
[elogind.git]
/
src
/
shared
/
hashmap.c
diff --git
a/src/shared/hashmap.c
b/src/shared/hashmap.c
index 20d599d04b3a04ab1c6525e36e40669cd2b388bb..e5f05f36f8fb93daf02b744d0cf5791f7ee1a9cc 100644
(file)
--- a/
src/shared/hashmap.c
+++ b/
src/shared/hashmap.c
@@
-733,29
+733,33
@@
static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) {
: hashmap_iterate_in_internal_order(h, i);
}
: hashmap_iterate_in_internal_order(h, i);
}
-
void *internal_hashmap_iterate(HashmapBase *h, Iterator *i
, const void **key) {
+
bool internal_hashmap_iterate(HashmapBase *h, Iterator *i, void **value
, const void **key) {
struct hashmap_base_entry *e;
void *data;
unsigned idx;
idx = hashmap_iterate_entry(h, i);
if (idx == IDX_NIL) {
struct hashmap_base_entry *e;
void *data;
unsigned idx;
idx = hashmap_iterate_entry(h, i);
if (idx == IDX_NIL) {
+ if (value)
+ *value = NULL;
if (key)
*key = NULL;
if (key)
*key = NULL;
- return
NULL
;
+ return
false
;
}
e = bucket_at(h, idx);
data = entry_value(h, e);
}
e = bucket_at(h, idx);
data = entry_value(h, e);
+ if (value)
+ *value = data;
if (key)
*key = e->key;
if (key)
*key = e->key;
- return
data
;
+ return
true
;
}
}
-
void *set_iterate(Set *s, Iterator *i
) {
- return internal_hashmap_iterate(HASHMAP_BASE(s), i, NULL);
+
bool set_iterate(Set *s, Iterator *i, void **value
) {
+ return internal_hashmap_iterate(HASHMAP_BASE(s), i,
value,
NULL);
}
#define HASHMAP_FOREACH_IDX(idx, h, i) \
}
#define HASHMAP_FOREACH_IDX(idx, h, i) \
@@
-1794,8
+1798,6
@@
void *ordered_hashmap_next(OrderedHashmap *h, const void *key) {
struct ordered_hashmap_entry *e;
unsigned hash, idx;
struct ordered_hashmap_entry *e;
unsigned hash, idx;
- assert(key);
-
if (!h)
return NULL;
if (!h)
return NULL;