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
dae121d9
Commit
dae121d9
authored
Apr 10, 2010
by
antirez
Browse files
dict.c fixed to play well with enabling/disabling of the hash table
parent
10d91d7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
dict.c
View file @
dae121d9
...
@@ -425,7 +425,7 @@ static int _dictExpandIfNeeded(dict *ht)
...
@@ -425,7 +425,7 @@ static int _dictExpandIfNeeded(dict *ht)
if
(
ht
->
size
==
0
)
if
(
ht
->
size
==
0
)
return
dictExpand
(
ht
,
DICT_HT_INITIAL_SIZE
);
return
dictExpand
(
ht
,
DICT_HT_INITIAL_SIZE
);
if
(
ht
->
used
>=
ht
->
size
&&
dict_can_resize
)
if
(
ht
->
used
>=
ht
->
size
&&
dict_can_resize
)
return
dictExpand
(
ht
,
ht
->
size
*
2
);
return
dictExpand
(
ht
,
((
ht
->
size
>
ht
->
used
)
?
ht
->
size
:
ht
->
used
)
*
2
);
return
DICT_OK
;
return
DICT_OK
;
}
}
...
@@ -519,7 +519,7 @@ void dictEnableResize(void) {
...
@@ -519,7 +519,7 @@ void dictEnableResize(void) {
}
}
void
dictDisableResize
(
void
)
{
void
dictDisableResize
(
void
)
{
dict_can_resize
=
1
;
dict_can_resize
=
0
;
}
}
/* ----------------------- StringCopy Hash Table Type ------------------------*/
/* ----------------------- StringCopy Hash Table Type ------------------------*/
...
...
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