From 94303a0750f9eaae3fcf598b7bf1320e521898fb Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 24 Nov 2014 22:19:50 -0800 Subject: util/hash_table: Rework the API to know about hashing Previously, the hash_table API required the user to do all of the hashing of keys as it passed them in. Since the hashing function is intrinsically tied to the comparison function, it makes sense for the hash table to know about it. Also, it makes for a somewhat clumsy API as the user is constantly calling hashing functions many of which have long names. This is especially bad when the standard call looks something like _mesa_hash_table_insert(ht, _mesa_pointer_hash(key), key, data); In the above case, there is no reason why the hash table shouldn't do the hashing for you. We leave the option for you to do your own hashing if it's more efficient, but it's no longer needed. Also, if you do do your own hashing, the hash table will assert that your hash matches what it expects out of the hashing function. This should make it harder to mess up your hashing. v2: change to call the old entrypoint "pre_hashed" rather than "with_hash", like cworth's equivalent change upstream (change by anholt, acked-in-general by Jason). Signed-off-by: Jason Ekstrand Signed-off-by: Eric Anholt Reviewed-by: Eric Anholt --- src/glsl/link_uniform_blocks.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/glsl/link_uniform_blocks.cpp') diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index 536fcd4..f5fc502 100644 --- a/src/glsl/link_uniform_blocks.cpp +++ b/src/glsl/link_uniform_blocks.cpp @@ -182,7 +182,8 @@ link_uniform_blocks(void *mem_ctx, * the hash is organized by block-name. */ struct hash_table *block_hash = - _mesa_hash_table_create(mem_ctx, _mesa_key_string_equal); + _mesa_hash_table_create(mem_ctx, _mesa_key_hash_string, + _mesa_key_string_equal); if (block_hash == NULL) { _mesa_error_no_memory(__func__); -- cgit v1.1