MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dictResize

Function dictResize

app/redis-6.2.6/src/dict.c:131–140  ·  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

129/* Resize the table to the minimal size that contains all the elements,
130 * but with the invariant of a USED/BUCKETS ratio near to <= 1 */
131int dictResize(dict *d)
132{
133 unsigned long minimal;
134
135 if (!dict_can_resize || dictIsRehashing(d)) return DICT_ERR;
136 minimal = d->ht[0].used;
137 if (minimal < DICT_HT_INITIAL_SIZE)
138 minimal = DICT_HT_INITIAL_SIZE;
139 return dictExpand(d, minimal);
140}
141
142/* Expand or create the hash table,
143 * when malloc_failed is non-NULL, it'll avoid panic if malloc fails (in which case it'll be set to 1).

Callers 7

mainFunction · 0.85
hashTypeDeleteFunction · 0.85
tryResizeHashTablesFunction · 0.85
setTypeRemoveFunction · 0.85
zsetDelFunction · 0.85
zremrangeGenericCommandFunction · 0.85
zdiffAlgorithm2Function · 0.85

Calls 1

dictExpandFunction · 0.70

Tested by

no test coverage detected