Resize the table to the minimal size that contains all the elements, * but with the invariant of a USED/BUCKETS ratio near to <= 1 */
| 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 */ |
| 175 | int 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). |
nothing calls this directly
no test coverage detected