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
d5712d21
Commit
d5712d21
authored
Mar 29, 2018
by
zhaozhao.zz
Committed by
antirez
Jun 12, 2018
Browse files
adjust position of _dictNextPower in dictExpand
parent
3ca02fb9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dict.c
View file @
d5712d21
...
@@ -146,14 +146,14 @@ int dictResize(dict *d)
...
@@ -146,14 +146,14 @@ int dictResize(dict *d)
/* Expand or create the hash table */
/* Expand or create the hash table */
int
dictExpand
(
dict
*
d
,
unsigned
long
size
)
int
dictExpand
(
dict
*
d
,
unsigned
long
size
)
{
{
dictht
n
;
/* the new hash table */
unsigned
long
realsize
=
_dictNextPower
(
size
);
/* the size is invalid if it is smaller than the number of
/* the size is invalid if it is smaller than the number of
* elements already inside the hash table */
* elements already inside the hash table */
if
(
dictIsRehashing
(
d
)
||
d
->
ht
[
0
].
used
>
size
)
if
(
dictIsRehashing
(
d
)
||
d
->
ht
[
0
].
used
>
size
)
return
DICT_ERR
;
return
DICT_ERR
;
dictht
n
;
/* the new hash table */
unsigned
long
realsize
=
_dictNextPower
(
size
);
/* Rehashing to the same table size is not useful. */
/* Rehashing to the same table size is not useful. */
if
(
realsize
==
d
->
ht
[
0
].
size
)
return
DICT_ERR
;
if
(
realsize
==
d
->
ht
[
0
].
size
)
return
DICT_ERR
;
...
...
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