diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-06-06 15:30:24 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-06-06 15:30:24 +0200 |
commit | 496be212ad645999647c432a856c906b86d41487 (patch) | |
tree | 1484f10758c161597850ae95e137de5e02487793 | |
parent | e84644aa88acd7158bb174946dbff630ff2389ad (diff) |
hashmap: introduce PA_HASHMAP_FOREACH macro
-rw-r--r-- | src/pulsecore/hashmap.h | 4 | ||||
-rw-r--r-- | src/pulsecore/idxset.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/pulsecore/hashmap.h b/src/pulsecore/hashmap.h index 08e18ead..828e2448 100644 --- a/src/pulsecore/hashmap.h +++ b/src/pulsecore/hashmap.h @@ -65,4 +65,8 @@ void *pa_hashmap_steal_first(pa_hashmap *h); /* Return the oldest entry in the hashmap */ void* pa_hashmap_first(pa_hashmap *h); +/* A macro to ease iteration through all entries */ +#define PA_HASHMAP_FOREACH(e, h, state) \ + for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), NULL); (e); (e) = pa_hashmap_iterate((h), &(state), NULL)) + #endif diff --git a/src/pulsecore/idxset.h b/src/pulsecore/idxset.h index 6b9ff472..a6179fcf 100644 --- a/src/pulsecore/idxset.h +++ b/src/pulsecore/idxset.h @@ -103,7 +103,7 @@ unsigned pa_idxset_size(pa_idxset*s); /* Return TRUE of the idxset is empty */ pa_bool_t pa_idxset_isempty(pa_idxset *s); - +/* A macro to ease iteration through all entries */ #define PA_IDXSET_FOREACH(e, s, idx) \ for ((e) = pa_idxset_first((s), &(idx)); (e); (e) = pa_idxset_next((s), &(idx))) |