From 6219275ffe90b91c927de06ffebc152f79b7bf59 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 28 May 2024 11:34:56 +1000 Subject: [PATCH] util/hash_table: add _mesa_string_hash_table_create() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds a string version of the _mesa_pointer_hash_table_create() helper allowing us to write tidy code. Acked-by: Marek Olšák Part-of: --- src/util/hash_table.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/hash_table.h b/src/util/hash_table.h index 136874ecdd6..84e6003f83d 100644 --- a/src/util/hash_table.h +++ b/src/util/hash_table.h @@ -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); /**