#include "qobj.h"
#include "defaults.h"
#include "libfrr.h"
+#include "jhash.h"
DEFINE_MTYPE(LIB, HOST, "Host config")
DEFINE_MTYPE(LIB, STRVEC, "String vector")
static unsigned int cmd_hash_key(void *p)
{
- return (uintptr_t)p;
+ int size = sizeof(p);
+
+ return jhash(p, size, 0);
}
static int cmd_hash_cmp(const void *a, const void *b)
cmd_token_new(START_TKN, CMD_ATTR_NORMAL, NULL, NULL);
graph_new_node(node->cmdgraph, token,
(void (*)(void *)) & cmd_token_del);
- node->cmd_hash = hash_create(cmd_hash_key, cmd_hash_cmp, NULL);
+ node->cmd_hash = hash_create_size(16, cmd_hash_key,
+ cmd_hash_cmp,
+ "Command Hash");
}
/**
void if_rmap_init(int node)
{
- ifrmaphash = hash_create(if_rmap_hash_make, if_rmap_hash_cmp, NULL);
+ ifrmaphash = hash_create_size(4,
+ if_rmap_hash_make,
+ if_rmap_hash_cmp,
+ "Interface Route-Map Hash");
if (node == RIPNG_NODE) {
} else if (node == RIP_NODE) {
install_element(RIP_NODE, &if_rmap_cmd);
#include "hash.h"
#include "log.h"
#include "qobj.h"
+#include "jhash.h"
static pthread_rwlock_t nodes_lock;
static struct hash *nodes = NULL;
{
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");
}
}
dep_entry = XCALLOC(MTYPE_ROUTE_MAP_DEP, sizeof(struct route_map_dep));
dep_entry->dep_name = XSTRDUP(MTYPE_ROUTE_MAP_NAME, dep_name);
- dep_entry->dep_rmap_hash = hash_create(route_map_dep_hash_make_key,
- route_map_rmap_hash_cmp, NULL);
+ dep_entry->dep_rmap_hash = hash_create_size(8,
+ route_map_dep_hash_make_key,
+ route_map_rmap_hash_cmp,
+ "Route Map Dep Hash");
dep_entry->this_hash = NULL;
return ((void *)dep_entry);
route_match_vec = vector_init(1);
route_set_vec = vector_init(1);
route_map_master_hash =
- hash_create(route_map_hash_key_make, route_map_hash_cmp, NULL);
+ hash_create_size(8, route_map_hash_key_make,
+ route_map_hash_cmp,
+ "Route Map Master Hash");
for (i = 1; i < ROUTE_MAP_DEP_MAX; i++)
route_map_dep_hash[i] =
- hash_create(route_map_dep_hash_make_key,
- route_map_dep_hash_cmp, NULL);
+ hash_create_size(8, route_map_dep_hash_make_key,
+ route_map_dep_hash_cmp,
+ "Route Map Dep Hash");
cmd_variable_handler_register(rmap_var_handlers);
#include "command.h"
#include "sigevent.h"
#include "network.h"
+#include "jhash.h"
DEFINE_MTYPE_STATIC(LIB, THREAD, "Thread")
DEFINE_MTYPE_STATIC(LIB, THREAD_MASTER, "Thread master")
/* CLI start ---------------------------------------------------------------- */
static unsigned int cpu_record_hash_key(struct cpu_thread_history *a)
{
- return (uintptr_t)a->func;
+ int size = sizeof (&a->func);
+
+ return jhash(&a->func, size, 0);
}
static int cpu_record_hash_cmp(const struct cpu_thread_history *a,
return NULL;
}
- rv->cpu_record = hash_create(
+ rv->cpu_record = hash_create_size(
+ 8,
(unsigned int (*)(void *))cpu_record_hash_key,
- (int (*)(const void *, const void *))cpu_record_hash_cmp, NULL);
+ (int (*)(const void *, const void *))cpu_record_hash_cmp,
+ "Thread Hash");
/* Initialize the timer queues */