Lines Matching refs:key

75     new_key  = (char**) calloc(d->size * 2, sizeof * d->key);  in dictionary_grow()
89 memcpy(new_key, d->key, d->size * sizeof(char *)); in dictionary_grow()
93 free(d->key); in dictionary_grow()
98 d->key = new_key; in dictionary_grow()
118 unsigned dictionary_hash(const char * key) in dictionary_hash() argument
124 if (!key) in dictionary_hash()
127 len = strlen(key); in dictionary_hash()
129 hash += (unsigned)key[i] ; in dictionary_hash()
162 d->key = (char**) calloc(size, sizeof * d->key); in dictionary_new()
183 if (d->key[i] != NULL) in dictionary_del()
184 free(d->key[i]); in dictionary_del()
189 free(d->key); in dictionary_del()
209 const char * dictionary_get(const dictionary * d, const char * key, const char * def) in dictionary_get() argument
214 hash = dictionary_hash(key); in dictionary_get()
216 if (d->key[i] == NULL) in dictionary_get()
221 if (!strcmp(key, d->key[i])) { in dictionary_get()
255 int dictionary_set(dictionary * d, const char * key, const char * val) in dictionary_set() argument
260 if (d == NULL || key == NULL) return -1 ; in dictionary_set()
263 hash = dictionary_hash(key) ; in dictionary_set()
267 if (d->key[i] == NULL) in dictionary_set()
270 if (!strcmp(key, d->key[i])) { /* Same key */ in dictionary_set()
292 for (i = d->n ; d->key[i] ; ) { in dictionary_set()
296 d->key[i] = xstrdup(key); in dictionary_set()
314 void dictionary_unset(dictionary * d, const char * key) in dictionary_unset() argument
319 if (key == NULL || d == NULL) { in dictionary_unset()
323 hash = dictionary_hash(key); in dictionary_unset()
325 if (d->key[i] == NULL) in dictionary_unset()
330 if (!strcmp(key, d->key[i])) { in dictionary_unset()
340 free(d->key[i]); in dictionary_unset()
341 d->key[i] = NULL ; in dictionary_unset()
373 if (d->key[i]) { in dictionary_dump()
375 d->key[i], in dictionary_dump()