[systemd-devel] [PATCH 3/6] hashmap.h: HASHMAP_FOREACH* iterate until ITERATOR_LAST
Lennart Poettering
lennart at poettering.net
Sun Sep 26 17:10:35 PDT 2010
On Fri, 24.09.10 12:06, harald at redhat.com (harald at redhat.com) wrote:
> From: Harald Hoyer <harald at redhat.com>
>
> ---
> src/hashmap.h | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/hashmap.h b/src/hashmap.h
> index ac5a8ae..64a468d 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_LAST; (e) = hashmap_iterate_backwards((h), &(i), NULL))
This fix should probably use FIRST not LAST here.
Fixed that and applied. Thanks!
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list