Lines Matching refs:key
73 char *key;
83 static unsigned long hash_value(const char *key);
84 static strhash_entry_t *find_entry(strhash_entry_t *entry, const char *key,
86 static strhash_entry_t *new_entry(const char *key, void *value);
141 idn__strhash_put(idn__strhash_t hash, const char *key, void *value) {
145 assert(hash != NULL && key != NULL);
147 h = hash_value(key);
150 if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
155 if ((entry = new_entry(key, value)) == NULL) {
177 idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep) {
181 assert(hash != NULL && key != NULL && valuep != NULL);
183 h = hash_value(key);
184 entry = find_entry(hash->bins[h % hash->nbins], key, h);
193 idn__strhash_exists(idn__strhash_t hash, const char *key) {
196 assert(hash != NULL && key != NULL);
198 h = hash_value(key);
199 return (find_entry(hash->bins[h % hash->nbins], key, h) != NULL);
203 hash_value(const char *key) {
205 unsigned char *p = (unsigned char *)key;
215 find_entry(strhash_entry_t *entry, const char *key, unsigned long hash) {
216 assert(key != NULL);
219 if (entry->hash_value == hash && strcmp(key, entry->key) == 0)
227 new_entry(const char *key, void *value) {
231 assert(key != NULL);
233 len = strlen(key) + 1;
238 entry->hash_value = hash_value(key);
239 entry->key = (char *)(entry + 1);
240 (void)strcpy(entry->key, key);