summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-27 20:13:21 +0200
committerLennart Poettering <lennart@poettering.net>2010-09-27 20:13:21 +0200
commitaed5e44d50656fc5b07e47a717cfe57cc08adc0f (patch)
treeef4fe5305d14d3fba7ef84c4e0fab40cc7be0fbb /src
parent313ed05bdb2350776e1332a68e2ff85a5e9fc4d3 (diff)
Revert "hashmap: HASHMAP_FOREACH* iterate until ITERATOR_LAST"
This reverts commit 66d9b3b59551a33398b2201662af5c8c17a367c9. If we check for i == ITERATOR_LAST we exit the loop one entry before the end. Instead we should return if e is NULL.
Diffstat (limited to 'src')
-rw-r--r--src/hashmap.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/hashmap.h b/src/hashmap.h
index 9f89d7c865..ac5a8ae085 100644
--- a/src/hashmap.h
+++ b/src/hashmap.h
@@ -77,12 +77,12 @@ void* hashmap_first(Hashmap *h);
void* hashmap_last(Hashmap *h);
#define HASHMAP_FOREACH(e, h, i) \
- for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); (i) != ITERATOR_LAST; (e) = hashmap_iterate((h), &(i), NULL))
+ for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); (e); (e) = hashmap_iterate((h), &(i), NULL))
#define HASHMAP_FOREACH_KEY(e, k, h, i) \
- for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), (const void**) &(k)); (i) != ITERATOR_LAST; (e) = hashmap_iterate((h), &(i), (const void**) &(k)))
+ for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), (const void**) &(k)); (e); (e) = hashmap_iterate((h), &(i), (const void**) &(k)))
#define HASHMAP_FOREACH_BACKWARDS(e, h, i) \
- for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (i) != ITERATOR_FIRST; (e) = hashmap_iterate_backwards((h), &(i), NULL))
+ for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (e); (e) = hashmap_iterate_backwards((h), &(i), NULL))
#endif