Skip to content

Commit

Permalink
dict.c fixed to play well with enabling/disabling of the hash table
Browse files Browse the repository at this point in the history
  • Loading branch information
antirez committed Apr 10, 2010
1 parent 10d91d7 commit dae121d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dict.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -519,7 +519,7 @@ void dictEnableResize(void) {
}

void dictDisableResize(void) {
dict_can_resize = 1;
dict_can_resize = 0;
}

/* ----------------------- StringCopy Hash Table Type ------------------------*/
Expand Down

0 comments on commit dae121d

Please sign in to comment.