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
77702083
Commit
77702083
authored
Feb 05, 2015
by
antirez
Browse files
dict.c: prevent useless resize to same size.
Related to issue #2306.
parent
170e4146
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/dict.c
View file @
77702083
...
@@ -211,6 +211,9 @@ int dictExpand(dict *d, unsigned long size)
...
@@ -211,6 +211,9 @@ int dictExpand(dict *d, unsigned long size)
if
(
dictIsRehashing
(
d
)
||
d
->
ht
[
0
].
used
>
size
)
if
(
dictIsRehashing
(
d
)
||
d
->
ht
[
0
].
used
>
size
)
return
DICT_ERR
;
return
DICT_ERR
;
/* Rehashing to the same table size is not useful. */
if
(
realsize
==
d
->
ht
[
0
].
size
)
return
DICT_ERR
;
/* Allocate the new hash table and initialize all pointers to NULL */
/* Allocate the new hash table and initialize all pointers to NULL */
n
.
size
=
realsize
;
n
.
size
=
realsize
;
n
.
sizemask
=
realsize
-
1
;
n
.
sizemask
=
realsize
-
1
;
...
...
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