From bd74dc610a2069f8549a26668940ef655f51598d Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 3 Sep 2017 18:50:35 -0400 Subject: lib: Hash creation cleanup 1) Some hash key functions where converting pointers directly to a 32 bit value via downcasting. Pointers are 64 bit on a majority of our platforms. 2) Some hashes were being created with 256 entries, downsize the hash creation size to more appropriate values. 3) Add hash names to hash creation so we can watch the hash via 'show debugging hashtable' Signed-off-by: Donald Sharp --- lib/qobj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/qobj.c') diff --git a/lib/qobj.c b/lib/qobj.c index 5f450ca0d3..c75002052e 100644 --- a/lib/qobj.c +++ b/lib/qobj.c @@ -25,6 +25,7 @@ #include "hash.h" #include "log.h" #include "qobj.h" +#include "jhash.h" static pthread_rwlock_t nodes_lock; static struct hash *nodes = NULL; @@ -97,7 +98,9 @@ void qobj_init(void) { if (!nodes) { pthread_rwlock_init(&nodes_lock, NULL); - nodes = hash_create(qobj_key, qobj_cmp, NULL); + nodes = hash_create_size(16, qobj_key, + qobj_cmp, + "QOBJ Hash"); } } -- cgit v1.2.3