Lines Matching refs:p_hash
32 struct hash_node** hash_get_bucket(struct hash* p_hash, void* p_key);
33 struct hash_node* hash_get_node_by_key(struct hash* p_hash, void* p_key);
40 struct hash* p_hash = vsf_sysutil_malloc(sizeof(*p_hash));
41 p_hash->buckets = buckets;
42 p_hash->key_size = key_size;
43 p_hash->value_size = value_size;
44 p_hash->hash_func = hash_func;
46 p_hash->p_nodes = vsf_sysutil_malloc(size);
47 vsf_sysutil_memclr(p_hash->p_nodes, size);
48 return p_hash;
52 hash_lookup_entry(struct hash* p_hash, void* p_key)
54 struct hash_node* p_node = hash_get_node_by_key(p_hash, p_key);
63 hash_add_entry(struct hash* p_hash, void* p_key, void* p_value)
67 if (hash_lookup_entry(p_hash, p_key))
71 p_bucket = hash_get_bucket(p_hash, p_key);
75 p_new_node->p_key = vsf_sysutil_malloc(p_hash->key_size);
76 vsf_sysutil_memcpy(p_new_node->p_key, p_key, p_hash->key_size);
77 p_new_node->p_value = vsf_sysutil_malloc(p_hash->value_size);
78 vsf_sysutil_memcpy(p_new_node->p_value, p_value, p_hash->value_size);
93 hash_free_entry(struct hash* p_hash, void* p_key)
95 struct hash_node* p_node = hash_get_node_by_key(p_hash, p_key);
109 struct hash_node** p_bucket = hash_get_bucket(p_hash, p_key);
121 hash_get_bucket(struct hash* p_hash, void* p_key)
123 unsigned int bucket = (*p_hash->hash_func)(p_hash->buckets, p_key);
124 if (bucket >= p_hash->buckets)
128 return &(p_hash->p_nodes[bucket]);
132 hash_get_node_by_key(struct hash* p_hash, void* p_key)
134 struct hash_node** p_bucket = hash_get_bucket(p_hash, p_key);
141 vsf_sysutil_memcmp(p_key, p_node->p_key, p_hash->key_size) != 0)