mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Make emptyDb() change introduced in #4852 simpler to read.
This commit is contained in:
parent
fe408ad23f
commit
1c2352f0dd
11
src/db.c
11
src/db.c
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user