mirror of
https://github.com/fluencelabs/redis
synced 2025-03-20 09:30:55 +00:00
dict.c fixed to play well with enabling/disabling of the hash table
This commit is contained in:
parent
10d91d7fb3
commit
dae121d9aa
4
dict.c
4
dict.c
@ -425,7 +425,7 @@ static int _dictExpandIfNeeded(dict *ht)
|
|||||||
if (ht->size == 0)
|
if (ht->size == 0)
|
||||||
return dictExpand(ht, DICT_HT_INITIAL_SIZE);
|
return dictExpand(ht, DICT_HT_INITIAL_SIZE);
|
||||||
if (ht->used >= ht->size && dict_can_resize)
|
if (ht->used >= ht->size && dict_can_resize)
|
||||||
return dictExpand(ht, ht->size*2);
|
return dictExpand(ht, ((ht->size > ht->used) ? ht->size : ht->used)*2);
|
||||||
return DICT_OK;
|
return DICT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ void dictEnableResize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dictDisableResize(void) {
|
void dictDisableResize(void) {
|
||||||
dict_can_resize = 1;
|
dict_can_resize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------- StringCopy Hash Table Type ------------------------*/
|
/* ----------------------- StringCopy Hash Table Type ------------------------*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user