Update sort.c

Redundant second if, and we may use "not" operation for bool, I suppose it's faster.
This commit is contained in:
Max Vetrov 2018-06-17 21:25:51 +02:00 committed by GitHub
parent 2e0ab4a807
commit d4c4f20a45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -447,7 +447,7 @@ void sortCommand(client *c) {
serverAssertWithInfo(c,sortval,j == vectorlen); serverAssertWithInfo(c,sortval,j == vectorlen);
/* Now it's time to load the right scores in the sorting vector */ /* Now it's time to load the right scores in the sorting vector */
if (dontsort == 0) { if (!dontsort) {
for (j = 0; j < vectorlen; j++) { for (j = 0; j < vectorlen; j++) {
robj *byval; robj *byval;
if (sortby) { if (sortby) {
@ -487,9 +487,7 @@ void sortCommand(client *c) {
decrRefCount(byval); decrRefCount(byval);
} }
} }
}
if (dontsort == 0) {
server.sort_desc = desc; server.sort_desc = desc;
server.sort_alpha = alpha; server.sort_alpha = alpha;
server.sort_bypattern = sortby ? 1 : 0; server.sort_bypattern = sortby ? 1 : 0;