Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

dict.c fixed to play well with enabling/disabling of the hash table

  • Loading branch information...
commit dae121d9aa38626db9962ff02879b55eb7ca36bf 1 parent 10d91d7
Salvatore Sanfilippo authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 dict.c
4 dict.c
View
@@ -425,7 +425,7 @@ static int _dictExpandIfNeeded(dict *ht)
if (ht->size == 0)
return dictExpand(ht, DICT_HT_INITIAL_SIZE);
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;
}
@@ -519,7 +519,7 @@ void dictEnableResize(void) {
}
void dictDisableResize(void) {
- dict_can_resize = 1;
+ dict_can_resize = 0;
}
/* ----------------------- StringCopy Hash Table Type ------------------------*/
Please sign in to comment.
Something went wrong with that request. Please try again.