Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
bf3a67be
Unverified
Commit
bf3a67be
authored
May 18, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
May 18, 2020
Browse files
Merge pull request #7252 from ShooterIT/dictsize
Use dictSize to get the size of dict in dict.c
parents
dd78f746
4afa243f
Changes
1
Show whitespace changes
Inline
Side-by-side
src/dict.c
View file @
bf3a67be
...
@@ -478,7 +478,7 @@ dictEntry *dictFind(dict *d, const void *key)
...
@@ -478,7 +478,7 @@ dictEntry *dictFind(dict *d, const void *key)
dictEntry
*
he
;
dictEntry
*
he
;
uint64_t
h
,
idx
,
table
;
uint64_t
h
,
idx
,
table
;
if
(
d
->
ht
[
0
].
used
+
d
->
ht
[
1
].
used
==
0
)
return
NULL
;
/* dict is empty */
if
(
d
ictSize
(
d
)
==
0
)
return
NULL
;
/* dict is empty */
if
(
dictIsRehashing
(
d
))
_dictRehashStep
(
d
);
if
(
dictIsRehashing
(
d
))
_dictRehashStep
(
d
);
h
=
dictHashKey
(
d
,
key
);
h
=
dictHashKey
(
d
,
key
);
for
(
table
=
0
;
table
<=
1
;
table
++
)
{
for
(
table
=
0
;
table
<=
1
;
table
++
)
{
...
@@ -1044,7 +1044,7 @@ dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t h
...
@@ -1044,7 +1044,7 @@ dictEntry **dictFindEntryRefByPtrAndHash(dict *d, const void *oldptr, uint64_t h
dictEntry
*
he
,
**
heref
;
dictEntry
*
he
,
**
heref
;
unsigned
long
idx
,
table
;
unsigned
long
idx
,
table
;
if
(
d
->
ht
[
0
].
used
+
d
->
ht
[
1
].
used
==
0
)
return
NULL
;
/* dict is empty */
if
(
d
ictSize
(
d
)
==
0
)
return
NULL
;
/* dict is empty */
for
(
table
=
0
;
table
<=
1
;
table
++
)
{
for
(
table
=
0
;
table
<=
1
;
table
++
)
{
idx
=
hash
&
d
->
ht
[
table
].
sizemask
;
idx
=
hash
&
d
->
ht
[
table
].
sizemask
;
heref
=
&
d
->
ht
[
table
].
table
[
idx
];
heref
=
&
d
->
ht
[
table
].
table
[
idx
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment