summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorShooterIT <wangyuancode@163.com>2020-05-07 11:04:08 +0800
committerShooterIT <wangyuancode@163.com>2020-05-07 11:04:08 +0800
commit4afa243ff18a8863650906fd4b5f9dce0d5ba106 (patch)
treecb462d02a39c793443723970d823b13f3c691eb3 /src/dict.c
parente17f9311c8ee18996e4b932a1284e4cfe29c05b4 (diff)
downloadredis-4afa243ff18a8863650906fd4b5f9dce0d5ba106.tar.gz
Use dictSize to get the size of dict in dict.c
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dict.c b/src/dict.c
index 13c185253..45aab66f9 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -478,7 +478,7 @@ dictEntry *dictFind(dict *d, const void *key)
dictEntry *he;
uint64_t h, idx, table;
- if (d->ht[0].used + d->ht[1].used == 0) return NULL; /* dict is empty */
+ if (dictSize(d) == 0) return NULL; /* dict is empty */
if (dictIsRehashing(d)) _dictRehashStep(d);
h = dictHashKey(d, key);
for (table = 0; table <= 1; table++) {
@@ -1044,7 +1044,7 @@ dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t h
dictEntry *he, **heref;
unsigned long idx, table;
- if (d->ht[0].used + d->ht[1].used == 0) return NULL; /* dict is empty */
+ if (dictSize(d) == 0) return NULL; /* dict is empty */
for (table = 0; table <= 1; table++) {
idx = hash & d->ht[table].sizemask;
heref = &d->ht[table].table[idx];