Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
5d4cd43e
Commit
5d4cd43e
authored
Sep 07, 2016
by
antirez
Browse files
dict.c better dictPushEntry initial index strategy.
parent
9554fd5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dict.c
View file @
5d4cd43e
...
@@ -182,9 +182,14 @@ dictEntry *dictPushEntry(dictEntryVector **table, unsigned int idx, const void *
...
@@ -182,9 +182,14 @@ dictEntry *dictPushEntry(dictEntryVector **table, unsigned int idx, const void *
memset
(
dv
->
entry
+
dv
->
used
,
0
,
sizeof
(
dictEntry
)
*
dv
->
free
);
memset
(
dv
->
entry
+
dv
->
used
,
0
,
sizeof
(
dictEntry
)
*
dv
->
free
);
}
else
{
}
else
{
uint32_t
entries
=
dv
->
used
+
dv
->
free
;
uint32_t
entries
=
dv
->
used
+
dv
->
free
;
uint32_t
j
;
/* Start iterating with j set to the number of buckets already
for
(
j
=
0
;
j
<
entries
;
j
++
)
{
* used: it is likely there are empty buckets at the end after
* a reallocation of the entries vector. */
uint32_t
j
=
dv
->
used
;
uint32_t
i
=
entries
;
while
(
i
--
)
{
if
(
dv
->
entry
[
j
].
key
==
NULL
)
break
;
if
(
dv
->
entry
[
j
].
key
==
NULL
)
break
;
j
=
(
j
+
1
)
%
entries
;
}
}
he
=
dv
->
entry
+
j
;
he
=
dv
->
entry
+
j
;
dv
->
used
++
;
dv
->
used
++
;
...
...
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