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
5ebaadc9
Unverified
Commit
5ebaadc9
authored
Jun 08, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 08, 2018
Browse files
Merge pull request #4800 from soloestoy/dict-expand
adjust position of _dictNextPower in dictExpand
parents
9fa2e702
83cf0e36
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dict.c
View file @
5ebaadc9
...
@@ -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