From a01a875081bd52bc1c3c142a60af678171ce6c33 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Wed, 5 Feb 2020 14:10:48 -0500 Subject: gallium/hash_table: consolidate hash tables with pointer keys Reviewed-by: Kristian H. Kristensen Part-of: --- src/gallium/auxiliary/util/u_debug_refcnt.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) (limited to 'src/gallium/auxiliary/util/u_debug_refcnt.c') diff --git a/src/gallium/auxiliary/util/u_debug_refcnt.c b/src/gallium/auxiliary/util/u_debug_refcnt.c index ec95f87260c..c1560fb7dc0 100644 --- a/src/gallium/auxiliary/util/u_debug_refcnt.c +++ b/src/gallium/auxiliary/util/u_debug_refcnt.c @@ -58,25 +58,6 @@ static struct util_hash_table *serials_hash; static unsigned serials_last; -static unsigned -hash_ptr(void *p) -{ - return (unsigned) (uintptr_t) p; -} - - -static int -compare_ptr(void *a, void *b) -{ - if (a == b) - return 0; - else if (a < b) - return -1; - else - return 1; -} - - /** * Return a small integer serial number for the given pointer. */ @@ -96,7 +77,7 @@ debug_serial(void *p, unsigned *pserial) mtx_lock(&serials_mutex); if (!serials_hash) - serials_hash = util_hash_table_create(hash_ptr, compare_ptr); + serials_hash = util_hash_table_create_ptr_keys(); serial = (unsigned) (uintptr_t) util_hash_table_get(serials_hash, p); if (!serial) { -- cgit v1.2.3