summaryrefslogtreecommitdiffstats
path: root/src/util/hash_table.c
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2018-09-11 16:37:33 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-01-14 10:49:21 -0800
commitee23e8b17c77fa94320168427fb8a10a84b50e94 (patch)
treec216f0b3ac903d31ff930683dcf9060ac0cad4f5 /src/util/hash_table.c
parent929df7afafb546d8af538085ff165cc62fdcb813 (diff)
util: Helper to create sets and hashes with pointer keys
These combinations are common enough and deserve a shortcut. Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/util/hash_table.c')
-rw-r--r--src/util/hash_table.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 4f510612a8f..57a5f247edc 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -548,6 +548,16 @@ _mesa_key_pointer_equal(const void *a, const void *b)
}
/**
+ * Helper to create a hash table with pointer keys.
+ */
+struct hash_table *
+_mesa_pointer_hash_table_create(void *mem_ctx)
+{
+ return _mesa_hash_table_create(mem_ctx, _mesa_hash_pointer,
+ _mesa_key_pointer_equal);
+}
+
+/**
* Hash table wrapper which supports 64-bit keys.
*
* TODO: unify all hash table implementations.