mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +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;
|
||||
}
|
||||
|
||||
int j = dbnum == -1 ? 0 : dbnum;
|
||||
int dbmax = dbnum == -1 ? server.dbnum : dbnum+1;
|
||||
int startdb, enddb;
|
||||
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;
|
||||
removed += dictSize(server.db[j].dict);
|
||||
if (async) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user