[pulseaudio-discuss] [PATCH 3/8] core: Added a macro to set keys as well when iterating through a hashmap.
Ștefan Săftescu
stefan.saftescu at gmail.com
Thu Jul 12 09:10:24 PDT 2012
---
src/pulsecore/hashmap.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/pulsecore/hashmap.h b/src/pulsecore/hashmap.h
index ac2092a..6cbee5a 100644
--- a/src/pulsecore/hashmap.h
+++ b/src/pulsecore/hashmap.h
@@ -80,4 +80,8 @@ void* pa_hashmap_last(pa_hashmap *h);
#define PA_HASHMAP_FOREACH_BACKWARDS(e, h, state) \
for ((state) = NULL, (e) = pa_hashmap_iterate_backwards((h), &(state), NULL); (e); (e) = pa_hashmap_iterate_backwards((h), &(state), NULL))
+/* A macro to ease iteration through all entries, using the key as well as the value */
+#define PA_HASHMAP_FOREACH_KEY(e, k, h, state) \
+ for ((state) = NULL, (e) = pa_hashmap_iterate((h), &(state), &(k)); (e); (e) = pa_hashmap_iterate((h), &(state), &(k)))
+
#endif
--
1.7.10.4
More information about the pulseaudio-discuss
mailing list