Lines Matching refs:key

54 static size_t ht_default_hash(HT_HANDLE *handle, const char *key);
76 * must be a power of two. The key size must be a positive integer.
77 * For null terminated keys, the key size does not need to include the
78 * null terminating character. The type of key is indicated by the
170 * on the specified key. This will identify the location for the
171 * corresponding item in the hash table. The handle and key pointers
177 ht_default_hash(HT_HANDLE *handle, const char *key)
183 while (*key) {
184 hash_ndx += *key;
185 ++key;
191 hash_ndx += *key;
192 ++key;
205 * for comparing items' key, it should not be called while there are
219 * handle and the key is used to generate a hashed index. The data
230 ht_add_item(HT_HANDLE *handle, const char *key, const void *data)
236 if (handle == 0 || key == 0)
242 key_len = strlen(key);
257 (void) memcpy(item->hi_key, key, key_len);
261 h_index = handle->ht_hash(handle, key);
280 * Replace an item in a hash table. The item associated with key is removed
287 ht_replace_item(HT_HANDLE *handle, const char *key, const void *data)
289 (void) ht_remove_item(handle, key);
291 return (ht_add_item(handle, key, data));
299 * first key found will be deleted. Note that the data pointer is never
308 ht_remove_item(HT_HANDLE *handle, const char *key)
315 if (handle == 0 || key == 0)
319 key_len = strlen(key) + 1;
323 h_index = handle->ht_hash(handle, key);
330 (handle->ht_cmp(cur->hi_key, key, key_len) == 0)) {
331 /* found key */
344 * Since the key and the item were allocated as
369 * indicate an error or that the key didn't match anything in the table.
372 ht_find_item(HT_HANDLE *handle, const char *key)
378 if (handle == 0 || key == 0)
382 key_len = strlen(key) + 1;
386 h_index = handle->ht_hash(handle, key);
391 (handle->ht_cmp(cur->hi_key, key, key_len) == 0))
467 * Since the key and the item were allocated as