Lines Matching refs:ht

63     apr_hash_t         *ht;
91 static apr_hash_entry_t **alloc_array(apr_hash_t *ht, unsigned int max)
93 return apr_pcalloc(ht->pool, sizeof(*ht->array) * (max + 1));
98 apr_hash_t *ht;
101 ht = apr_palloc(pool, sizeof(apr_hash_t));
102 ht->pool = pool;
103 ht->free = NULL;
104 ht->count = 0;
105 ht->max = INITIAL_MAX;
106 ht->seed = (unsigned int)((now >> 32) ^ now ^ (apr_uintptr_t)pool ^
107 (apr_uintptr_t)ht ^ (apr_uintptr_t)&now) - 1;
108 ht->array = alloc_array(ht, ht->max);
109 ht->hash_func = NULL;
111 return ht;
117 apr_hash_t *ht = apr_hash_make(pool);
118 ht->hash_func = hash_func;
119 return ht;
131 if (hi->index > hi->ht->max)
134 hi->this = hi->ht->array[hi->index++];
140 APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht)
146 hi = &ht->iterator;
148 hi->ht = ht;
193 static void expand_array(apr_hash_t *ht)
199 new_max = ht->max * 2 + 1;
200 new_array = alloc_array(ht, new_max);
201 for (hi = apr_hash_first(NULL, ht); hi; hi = apr_hash_next(hi)) {
206 ht->array = new_array;
207 ht->max = new_max;
285 static apr_hash_entry_t **find_entry(apr_hash_t *ht,
293 if (ht->hash_func)
294 hash = ht->hash_func(key, &klen);
296 hash = hashfunc_default(key, &klen, ht->seed);
299 for (hep = &ht->array[hash & ht->max], he = *hep;
310 if ((he = ht->free) != NULL)
311 ht->free = he->next;
313 he = apr_palloc(ht->pool, sizeof(*he));
320 ht->count++;
327 apr_hash_t *ht;
331 ht = apr_palloc(pool, sizeof(apr_hash_t) +
332 sizeof(*ht->array) * (orig->max + 1) +
334 ht->pool = pool;
335 ht->free = NULL;
336 ht->count = orig->count;
337 ht->max = orig->max;
338 ht->seed = orig->seed;
339 ht->hash_func = orig->hash_func;
340 ht->array = (apr_hash_entry_t **)((char *)ht + sizeof(apr_hash_t));
342 new_vals = (apr_hash_entry_t *)((char *)(ht) + sizeof(apr_hash_t) +
343 sizeof(*ht->array) * (orig->max + 1));
345 for (i = 0; i <= ht->max; i++) {
346 apr_hash_entry_t **new_entry = &(ht->array[i]);
359 return ht;
362 APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht,
367 he = *find_entry(ht, key, klen, NULL);
374 APR_DECLARE(void) apr_hash_set(apr_hash_t *ht,
380 hep = find_entry(ht, key, klen, val);
386 old->next = ht->free;
387 ht->free = old;
388 --ht->count;
394 if (ht->count > ht->max) {
395 expand_array(ht);
402 APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht)
404 return ht->count;
407 APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht)
410 for (hi = apr_hash_first(NULL, ht); hi; hi = apr_hash_next(hi))
411 apr_hash_set(ht, hi->this->key, hi->this->klen, NULL);
528 void *rec, const apr_hash_t *ht)
534 hix.ht = (apr_hash_t *)ht;