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
8aaf5075
Commit
8aaf5075
authored
Jan 23, 2015
by
antirez
Browse files
dict.c: make chaining strategy more clear in dictAddRaw().
parent
7885e126
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dict.c
View file @
8aaf5075
...
@@ -342,7 +342,10 @@ dictEntry *dictAddRaw(dict *d, void *key)
...
@@ -342,7 +342,10 @@ dictEntry *dictAddRaw(dict *d, void *key)
if
((
index
=
_dictKeyIndex
(
d
,
key
))
==
-
1
)
if
((
index
=
_dictKeyIndex
(
d
,
key
))
==
-
1
)
return
NULL
;
return
NULL
;
/* Allocate the memory and store the new entry */
/* Allocate the memory and store the new entry.
* Insert the element in top, with the assumption that in a database
* system it is more likely that recently added entries are accessed
* more frequently. */
ht
=
dictIsRehashing
(
d
)
?
&
d
->
ht
[
1
]
:
&
d
->
ht
[
0
];
ht
=
dictIsRehashing
(
d
)
?
&
d
->
ht
[
1
]
:
&
d
->
ht
[
0
];
entry
=
zmalloc
(
sizeof
(
*
entry
));
entry
=
zmalloc
(
sizeof
(
*
entry
));
entry
->
next
=
ht
->
table
[
index
];
entry
->
next
=
ht
->
table
[
index
];
...
...
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