]> code.delx.au - pulseaudio/commitdiff
hashmap: introduce PA_HASHMAP_FOREACH macro
authorLennart Poettering <lennart@poettering.net>
Sat, 6 Jun 2009 13:30:24 +0000 (15:30 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 6 Jun 2009 13:30:24 +0000 (15:30 +0200)
src/pulsecore/hashmap.h
src/pulsecore/idxset.h

index 08e18ead92e99c8b2f45c68e9bbf99b7a172f687..828e24489bfda9e472cd05b80e96d9576c9ee8a3 100644 (file)
@@ -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
index 6b9ff472c509503603c6f17e0e63c04cbb643bde..a6179fcf125940694a7f51b9ee1c9fb2f205c4bb 100644 (file)
@@ -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)))