Lines Matching refs:key
75 char *key;
85 static unsigned long hash_value(const char *key);
86 static strhash_entry_t *find_entry(strhash_entry_t *entry, const char *key,
88 static strhash_entry_t *new_entry(const char *key, void *value);
143 idn__strhash_put(idn__strhash_t hash, const char *key, void *value) {
147 assert(hash != NULL && key != NULL);
149 h = hash_value(key);
152 if ((entry = find_entry(hash->bins[h_index], key, h)) != NULL) {
157 if ((entry = new_entry(key, value)) == NULL) {
179 idn__strhash_get(idn__strhash_t hash, const char *key, void **valuep) {
183 assert(hash != NULL && key != NULL && valuep != NULL);
185 h = hash_value(key);
186 entry = find_entry(hash->bins[h % hash->nbins], key, h);
195 idn__strhash_exists(idn__strhash_t hash, const char *key) {
198 assert(hash != NULL && key != NULL);
200 h = hash_value(key);
201 return (find_entry(hash->bins[h % hash->nbins], key, h) != NULL);
205 hash_value(const char *key) {
207 unsigned char *p = (unsigned char *)key;
217 find_entry(strhash_entry_t *entry, const char *key, unsigned long hash) {
218 assert(key != NULL);
221 if (entry->hash_value == hash && strcmp(key, entry->key) == 0)
229 new_entry(const char *key, void *value) {
233 assert(key != NULL);
235 len = strlen(key) + 1;
240 entry->hash_value = hash_value(key);
241 entry->key = (char *)(entry + 1);
242 (void)strcpy(entry->key, key);