Lines Matching refs:key

51 static size_t ht_default_hash(HT_HANDLE *handle, const char *key);
73 * must be a power of two. The key size must be a positive integer.
74 * For null terminated keys, the key size does not need to include the
75 * null terminating character. The type of key is indicated by the flags.
166 * on the specified key. This will identify the location for the
167 * corresponding item in the hash table. The handle and key pointers
173 ht_default_hash(HT_HANDLE *handle, const char *key)
179 while (*key) {
180 hash_ndx += *key;
181 ++key;
187 hash_ndx += *key;
188 ++key;
201 * for comparing items' key, it should not be called while there are
215 * handle and the key is used to generate a hashed index. The data
226 ht_add_item(HT_HANDLE *handle, const char *key, const void *data)
232 if (handle == 0 || key == 0)
238 key_len = strlen(key);
253 (void) memcpy(item->hi_key, key, key_len);
257 h_index = handle->ht_hash(handle, key);
276 * Replace an item in a hash table. The item associated with key is removed
283 ht_replace_item(HT_HANDLE *handle, const char *key, const void *data)
285 (void) ht_remove_item(handle, key);
287 return (ht_add_item(handle, key, data));
295 * first key found will be deleted. Note that the data pointer is never
304 ht_remove_item(HT_HANDLE *handle, const char *key)
311 if (handle == 0 || key == 0)
315 key_len = strlen(key) + 1;
319 h_index = handle->ht_hash(handle, key);
326 (handle->ht_cmp(cur->hi_key, key, key_len) == 0)) {
327 /* found key */
340 * Since the key and the item were allocated as
365 * indicate an error or that the key didn't match anything in the table.
368 ht_find_item(HT_HANDLE *handle, const char *key)
374 if (handle == 0 || key == 0)
378 key_len = strlen(key) + 1;
382 h_index = handle->ht_hash(handle, key);
387 (handle->ht_cmp(cur->hi_key, key, key_len) == 0))
463 * Since the key and the item were allocated as