• Home
  • Raw
  • Download

Lines Matching full:buckets

43   /* NOTE: if we converted buckets into ares_slist_t we could guarantee on
49 ares_llist_t **buckets; member
71 static void ares_htable_buckets_destroy(ares_llist_t **buckets, in ares_htable_buckets_destroy() argument
77 if (buckets == NULL) { in ares_htable_buckets_destroy()
82 if (buckets[i] == NULL) { in ares_htable_buckets_destroy()
87 ares_llist_replace_destructor(buckets[i], NULL); in ares_htable_buckets_destroy()
90 ares_llist_destroy(buckets[i]); in ares_htable_buckets_destroy()
93 ares_free(buckets); in ares_htable_buckets_destroy()
101 ares_htable_buckets_destroy(htable->buckets, htable->size, ARES_TRUE); in ares_htable_destroy()
128 htable->buckets = ares_malloc_zero(sizeof(*htable->buckets) * htable->size); in ares_htable_create()
130 if (htable->buckets == NULL) { in ares_htable_create()
160 for (node = ares_llist_node_first(htable->buckets[i]); node != NULL; in ares_htable_all_buckets()
182 for (node = ares_llist_node_first(htable->buckets[idx]); node != NULL; in ares_htable_find()
194 ares_llist_t **buckets = NULL; in ares_htable_expand() local
211 buckets = ares_malloc_zero(sizeof(*buckets) * htable->size); in ares_htable_expand()
212 if (buckets == NULL) { in ares_htable_expand()
233 /* Iterate across all buckets and move the entries to the new buckets */ in ares_htable_expand()
239 if (htable->buckets[i] == NULL) { in ares_htable_expand()
246 if (ares_llist_len(htable->buckets[i]) == 1) { in ares_htable_expand()
247 const void *val = ares_llist_first_val(htable->buckets[i]); in ares_htable_expand()
250 if (buckets[idx] == NULL) { in ares_htable_expand()
252 buckets[idx] = htable->buckets[i]; in ares_htable_expand()
253 htable->buckets[i] = NULL; in ares_htable_expand()
259 while ((node = ares_llist_node_first(htable->buckets[i])) != NULL) { in ares_htable_expand()
265 if (buckets[idx] == NULL && ares_llist_len(htable->buckets[i]) == 1) { in ares_htable_expand()
267 buckets[idx] = htable->buckets[i]; in ares_htable_expand()
268 htable->buckets[i] = NULL; in ares_htable_expand()
273 if (buckets[idx] == NULL) { in ares_htable_expand()
278 buckets[idx] = prealloc_llist[prealloc_llist_len - 1]; in ares_htable_expand()
285 ares_llist_node_mvparent_first(node, buckets[idx]); in ares_htable_expand()
289 if (htable->buckets[i] != NULL) { in ares_htable_expand()
290 ares_llist_destroy(htable->buckets[i]); in ares_htable_expand()
291 htable->buckets[i] = NULL; in ares_htable_expand()
295 /* We have guaranteed all the buckets have either been moved or destroyed, in ares_htable_expand()
297 ares_free(htable->buckets); in ares_htable_expand()
298 htable->buckets = buckets; in ares_htable_expand()
299 buckets = NULL; in ares_htable_expand()
303 ares_free(buckets); in ares_htable_expand()
304 /* destroy any unused preallocated buckets */ in ares_htable_expand()
349 if (htable->buckets[idx] == NULL) { in ares_htable_insert()
350 htable->buckets[idx] = ares_llist_create(htable->bucket_free); in ares_htable_insert()
351 if (htable->buckets[idx] == NULL) { in ares_htable_insert()
356 node = ares_llist_insert_first(htable->buckets[idx], bucket); in ares_htable_insert()
362 if (ares_llist_len(htable->buckets[idx]) > 1) { in ares_htable_insert()