mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
adjust position of _dictNextPower in dictExpand
This commit is contained in:
parent
e08d6bb37e
commit
83cf0e3668
@ -146,14 +146,14 @@ int dictResize(dict *d)
|
||||
/* Expand or create the hash table */
|
||||
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
|
||||
* elements already inside the hash table */
|
||||
if (dictIsRehashing(d) || d->ht[0].used > size)
|
||||
return DICT_ERR;
|
||||
|
||||
dictht n; /* the new hash table */
|
||||
unsigned long realsize = _dictNextPower(size);
|
||||
|
||||
/* Rehashing to the same table size is not useful. */
|
||||
if (realsize == d->ht[0].size) return DICT_ERR;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user