MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / HashTableResize

Function HashTableResize

src/util/dict.c:175–184  ·  view source on GitHub ↗

Resize the table to the minimal size that contains all the elements, * but with the invariant of a USED/BUCKETS ratio near to <= 1 */

Source from the content-addressed store, hash-verified

173/* Resize the table to the minimal size that contains all the elements,
174 * but with the invariant of a USED/BUCKETS ratio near to <= 1 */
175int HashTableResize(dict *d)
176{
177 unsigned long minimal;
178
179 if (dict_can_resize != DICT_RESIZE_ENABLE || dictIsRehashing(d)) return DICT_ERR;
180 minimal = d->ht_used[0];
181 if (minimal < DICT_HT_INITIAL_SIZE)
182 minimal = DICT_HT_INITIAL_SIZE;
183 return HashTableExpand(d, minimal);
184}
185
186/* Expand or create the hash table,
187 * when malloc_failed is non-NULL, it'll avoid panic if malloc fails (in which case it'll be set to 1).

Callers

nothing calls this directly

Calls 1

HashTableExpandFunction · 0.85

Tested by

no test coverage detected