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
1c2352f0
Commit
1c2352f0
authored
Jul 25, 2018
by
antirez
Browse files
Make emptyDb() change introduced in #4852 simpler to read.
parent
fe408ad2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
1c2352f0
...
@@ -337,10 +337,15 @@ long long emptyDb(int dbnum, int flags, void(callback)(void*)) {
...
@@ -337,10 +337,15 @@ long long emptyDb(int dbnum, int flags, void(callback)(void*)) {
return
-
1
;
return
-
1
;
}
}
int j = dbnum == -1 ? 0 : dbnum;
int
startdb
,
enddb
;
int dbmax = dbnum == -1 ? server.dbnum : dbnum+1;
if
(
dbnum
==
-
1
)
{
startdb
=
0
;
enddb
=
server
.
dbnum
-
1
;
}
else
{
startdb
=
enddb
=
dbnum
;
}
for (
; j < dbmax
; j++) {
for
(
int
j
=
startdb
;
j
<=
enddb
;
j
++
)
{
if
(
dbnum
!=
-
1
&&
dbnum
!=
j
)
continue
;
if
(
dbnum
!=
-
1
&&
dbnum
!=
j
)
continue
;
removed
+=
dictSize
(
server
.
db
[
j
].
dict
);
removed
+=
dictSize
(
server
.
db
[
j
].
dict
);
if
(
async
)
{
if
(
async
)
{
...
...
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