Lines Matching defs:key
57 * each of which has a key of key_size bytes and a value of value_size
93 * Places the key-value pair to the hashtable tbl.
95 * HASH_OK: if the key was not present in the hash table yet
97 * HASH_UPDATED: if the value for the key has been updated with the
105 hashtable_put(hashtable *tbl, const void *key, const void *value)
115 hash = hash32_buf(key, tbl->key_size, hash) % tbl->table_size;
121 * with the same key (and update it) or we find a free space.
127 else if (memcmp(tbl->entries[hash]->key, key, tbl->key_size) == 0)
147 tbl->entries[hash]->key = malloc(tbl->key_size);
148 if (tbl->entries[hash]->key == NULL)
161 memcpy(tbl->entries[hash]->key, key, tbl->key_size);
170 free(tbl->entries[hash]->key);
179 **hashtable_lookup(const hashtable *tbl, const void *key)
183 hash = hash32_buf(key, tbl->key_size, hash) % tbl->table_size;
189 else if (memcmp(key, tbl->entries[hash]->key, tbl->key_size) == 0)
201 * Retrieves the value for key from the hash table tbl and places
207 hashtable_get(hashtable *tbl, const void *key, void *value)
211 entry = hashtable_lookup(tbl, key);
224 * Removes the entry with the specifified key from the hash table
229 hashtable_remove(hashtable *tbl, const void *key)
233 entry = hashtable_lookup(tbl, key);
240 free((*entry)->key);
262 free(tbl->entries[i]->key);