Lines Matching refs:buckets
45 /* NOTE: if we converted buckets into ares__slist_t we could guarantee on
51 ares__llist_t **buckets;
68 static void ares__htable_buckets_destroy(ares__llist_t **buckets,
74 if (buckets == NULL) {
79 if (buckets[i] == NULL) {
84 ares__llist_replace_destructor(buckets[i], NULL);
87 ares__llist_destroy(buckets[i]);
90 ares_free(buckets);
98 ares__htable_buckets_destroy(htable->buckets, htable->size, ARES_TRUE);
125 htable->buckets = ares_malloc_zero(sizeof(*htable->buckets) * htable->size);
127 if (htable->buckets == NULL) {
157 for (node = ares__llist_node_first(htable->buckets[i]); node != NULL;
179 for (node = ares__llist_node_first(htable->buckets[idx]); node != NULL;
191 ares__llist_t **buckets = NULL;
208 buckets = ares_malloc_zero(sizeof(*buckets) * htable->size);
209 if (buckets == NULL) {
230 /* Iterate across all buckets and move the entries to the new buckets */
236 if (htable->buckets[i] == NULL) {
243 if (ares__llist_len(htable->buckets[i]) == 1) {
244 const void *val = ares__llist_first_val(htable->buckets[i]);
247 if (buckets[idx] == NULL) {
249 buckets[idx] = htable->buckets[i];
250 htable->buckets[i] = NULL;
256 while ((node = ares__llist_node_first(htable->buckets[i])) != NULL) {
262 if (buckets[idx] == NULL && ares__llist_len(htable->buckets[i]) == 1) {
264 buckets[idx] = htable->buckets[i];
265 htable->buckets[i] = NULL;
270 if (buckets[idx] == NULL) {
275 buckets[idx] = prealloc_llist[prealloc_llist_len - 1];
282 ares__llist_node_move_parent_first(node, buckets[idx]);
286 if (htable->buckets[i] != NULL) {
287 ares__llist_destroy(htable->buckets[i]);
288 htable->buckets[i] = NULL;
292 /* We have guaranteed all the buckets have either been moved or destroyed,
294 ares_free(htable->buckets);
295 htable->buckets = buckets;
296 buckets = NULL;
300 ares_free(buckets);
301 /* destroy any unused preallocated buckets */
346 if (htable->buckets[idx] == NULL) {
347 htable->buckets[idx] = ares__llist_create(htable->bucket_free);
348 if (htable->buckets[idx] == NULL) {
353 node = ares__llist_insert_first(htable->buckets[idx], bucket);
359 if (ares__llist_len(htable->buckets[idx]) > 1) {