util/hash_table: add _mesa_string_hash_table_create() helper

This adds a string version of the _mesa_pointer_hash_table_create()
helper allowing us to write tidy code.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31137>
This commit is contained in:
Timothy Arceri 2024-05-28 11:34:56 +10:00 committed by Marge Bot
parent 7c5b21c032
commit 6219275ffe

View file

@ -130,6 +130,13 @@ bool _mesa_key_pointer_equal(const void *a, const void *b);
struct hash_table *
_mesa_pointer_hash_table_create(void *mem_ctx);
static inline struct hash_table *
_mesa_string_hash_table_create(void *mem_ctx)
{
return _mesa_hash_table_create(mem_ctx, _mesa_hash_string,
_mesa_key_string_equal);
}
bool
_mesa_hash_table_reserve(struct hash_table *ht, unsigned size);
/**