From ee23e8b17c77fa94320168427fb8a10a84b50e94 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Tue, 11 Sep 2018 16:37:33 -0700 Subject: util: Helper to create sets and hashes with pointer keys These combinations are common enough and deserve a shortcut. Reviewed-by: Jason Ekstrand Acked-by: Eric Engestrom --- src/util/hash_table.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/util/hash_table.c') 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 @@ -547,6 +547,16 @@ _mesa_key_pointer_equal(const void *a, const void *b) return a == 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. * -- cgit v1.2.3