mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Merge pull request #4800 from soloestoy/dict-expand
adjust position of _dictNextPower in dictExpand
This commit is contained in:
commit
5ebaadc96b
@ -146,14 +146,14 @@ int dictResize(dict *d)
|
|||||||
/* Expand or create the hash table */
|
/* Expand or create the hash table */
|
||||||
int dictExpand(dict *d, unsigned long size)
|
int dictExpand(dict *d, unsigned long size)
|
||||||
{
|
{
|
||||||
dictht n; /* the new hash table */
|
|
||||||
unsigned long realsize = _dictNextPower(size);
|
|
||||||
|
|
||||||
/* the size is invalid if it is smaller than the number of
|
/* the size is invalid if it is smaller than the number of
|
||||||
* elements already inside the hash table */
|
* elements already inside the hash table */
|
||||||
if (dictIsRehashing(d) || d->ht[0].used > size)
|
if (dictIsRehashing(d) || d->ht[0].used > size)
|
||||||
return DICT_ERR;
|
return DICT_ERR;
|
||||||
|
|
||||||
|
dictht n; /* the new hash table */
|
||||||
|
unsigned long realsize = _dictNextPower(size);
|
||||||
|
|
||||||
/* Rehashing to the same table size is not useful. */
|
/* Rehashing to the same table size is not useful. */
|
||||||
if (realsize == d->ht[0].size) return DICT_ERR;
|
if (realsize == d->ht[0].size) return DICT_ERR;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user