dict.c/dictRehash: check again to update

This commit is contained in:
Sun He 2015-02-06 11:18:58 +08:00 committed by antirez
parent 4f427bc298
commit 2385630d0d

View File

@ -282,6 +282,13 @@ int dictRehash(dict *d, int n) {
d->ht[0].table[d->rehashidx] = NULL;
d->rehashidx++;
}
/* Check again if we already rehashed the whole table... */
if (d->ht[0].used == 0) {
zfree(d->ht[0].table);
d->ht[0] = d->ht[1];
_dictReset(&d->ht[1]);
d->rehashidx = -1;
}
return 1;
}