return DICT_ERR if expand failed due to memory allocation failure */
| 340 | |
| 341 | /* return DICT_ERR if expand failed due to memory allocation failure */ |
| 342 | int dictTryExpand(dict *d, unsigned long size, bool fShrink) { |
| 343 | int malloc_failed; |
| 344 | // External expand likely means mass insertion, and we don't want to shrink during that |
| 345 | d->noshrink = true; |
| 346 | _dictExpand(d, size, fShrink, &malloc_failed); |
| 347 | return malloc_failed? DICT_ERR : DICT_OK; |
| 348 | } |
| 349 | |
| 350 | /* Performs N steps of incremental rehashing. Returns 1 if there are still |
| 351 | * keys to move from the old to the new hash table, otherwise 0 is returned. |
no test coverage detected