summaryrefslogtreecommitdiffstats
path: root/src/util/hash_table.h
diff options
context:
space:
mode:
authorThomas Helland <[email protected]>2016-08-16 22:10:17 +0200
committerTimothy Arceri <[email protected]>2016-09-12 10:48:35 +1000
commitddb8639b18e836b904cda857d787c05ab8b0db7b (patch)
tree970e1391635c9d61cd61e6395809c3159da84442 /src/util/hash_table.h
parentcf4a4820ac36784cea18cd0393f8ae1bdc853c68 (diff)
util: Move hash_table_call_foreach to util hash table
It is included through the util/hash_table include in the program hash_table, so this should be safe. This will be needed when we start converting each use of the program_hash_table, as some places need this function. Signed-off-by: Thomas Helland <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/util/hash_table.h')
-rw-r--r--src/util/hash_table.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/hash_table.h b/src/util/hash_table.h
index c69abfa3e64..b35ee871bb3 100644
--- a/src/util/hash_table.h
+++ b/src/util/hash_table.h
@@ -139,6 +139,19 @@ _mesa_fnv32_1a_accumulate_block(uint32_t hash, const void *data, size_t size)
entry != NULL; \
entry = _mesa_hash_table_next_entry(ht, entry))
+static inline void
+hash_table_call_foreach(struct hash_table *ht,
+ void (*callback)(const void *key,
+ void *data,
+ void *closure),
+ void *closure)
+{
+ struct hash_entry *entry;
+
+ hash_table_foreach(ht, entry)
+ callback(entry->key, entry->data, closure);
+}
+
#ifdef __cplusplus
} /* extern C */
#endif