chiark / gitweb /
hashmap: HASHMAP_FOREACH* iterate until ITERATOR_LAST
authorHarald Hoyer <harald@redhat.com>
Fri, 24 Sep 2010 10:06:01 +0000 (12:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 27 Sep 2010 00:09:47 +0000 (02:09 +0200)
src/hashmap.h

index ac5a8ae0856cdc146b3ff3f4fce0521246d5b6a3..9f89d7c865af366cf64bf2b2995a2e76b2d225fd 100644 (file)
@@ -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); (e); (e) = hashmap_iterate((h), &(i), NULL))
+        for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); (i) != ITERATOR_LAST; (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)); (e); (e) = hashmap_iterate((h), &(i), (const void**) &(k)))
+        for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), (const void**) &(k)); (i) != ITERATOR_LAST; (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); (e); (e) = hashmap_iterate_backwards((h), &(i), NULL))
+        for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (i) != ITERATOR_FIRST; (e) = hashmap_iterate_backwards((h), &(i), NULL))
 
 #endif