Unverified Commit 5ebaadc9 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo Committed by GitHub
Browse files

Merge pull request #4800 from soloestoy/dict-expand

adjust position of _dictNextPower in dictExpand
parents 9fa2e702 83cf0e36
...@@ -146,14 +146,14 @@ int dictResize(dict *d) ...@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment