[Mesa-dev] [PATCH 10/18] util: Add a call_foreach function to the pointer map

Thomas Helland thomashelland90 at gmail.com
Wed Apr 11 18:48:19 UTC 2018


---
 src/util/pointer_map.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/util/pointer_map.h b/src/util/pointer_map.h
index 4bfc306a5f..f92e67d40d 100644
--- a/src/util/pointer_map.h
+++ b/src/util/pointer_map.h
@@ -91,6 +91,19 @@ _mesa_pointer_map_next_entry(struct pointer_map *map,
         entry != NULL;                                  \
         entry = _mesa_pointer_map_next_entry(map, entry))
 
+static inline void
+_mesa_pointer_map_call_foreach(struct pointer_map *pm,
+                               void (*callback)(const void *key,
+                                                void *data,
+                                                void *closure),
+                               void *closure)
+{
+   struct map_entry *entry;
+
+   _mesa_pointer_map_foreach(pm, entry)
+      callback(entry->key, entry->data, closure);
+}
+
 #ifdef __cplusplus
 } /* extern C */
 #endif
-- 
2.16.2



More information about the mesa-dev mailing list