From: Harald Hoyer Date: Fri, 24 Sep 2010 10:06:01 +0000 (+0200) Subject: hashmap: HASHMAP_FOREACH* iterate until ITERATOR_LAST X-Git-Tag: v11~75 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66d9b3b59551a33398b2201662af5c8c17a367c9;p=systemd hashmap: HASHMAP_FOREACH* iterate until ITERATOR_LAST --- diff --git a/src/hashmap.h b/src/hashmap.h index ac5a8ae0..9f89d7c8 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); (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