summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-05-18 10:33:08 +0200
committerGitHub <noreply@github.com>2020-05-18 10:33:08 +0200
commitbf3a67be437e6a3cd5189116d9ad628492db0c4d (patch)
tree0af965af78abdc783f00846041c26d7c7c62d8ee
parentdd78f7463fc044135dd82931edc6dcc9bc3a019d (diff)
parent4afa243ff18a8863650906fd4b5f9dce0d5ba106 (diff)
downloadredis-bf3a67be437e6a3cd5189116d9ad628492db0c4d.tar.gz
Merge pull request #7252 from ShooterIT/dictsize
Use dictSize to get the size of dict in 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];