Skip to content

Commit

Permalink
Flatten comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Mar 8, 2024
1 parent 9c347e3 commit e0007d1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/checkother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1496,17 +1496,15 @@ namespace {
bool operator()(const Variable* a, const Variable* b) const {
const int fileA = a->nameToken()->fileIndex();
const int fileB = b->nameToken()->fileIndex();
if (fileA == fileB) {
const int lineA = a->nameToken()->linenr();
const int lineB = b->nameToken()->linenr();
if (lineA == lineB) {
const int columnA = a->nameToken()->column();
const int columnB = b->nameToken()->column();
return columnA < columnB;
}
if (fileA != fileB)
return fileA < fileB;
const int lineA = a->nameToken()->linenr();
const int lineB = b->nameToken()->linenr();
if (lineA != lineB)
return lineA < lineB;
}
return fileA < fileB;
const int columnA = a->nameToken()->column();
const int columnB = b->nameToken()->column();
return columnA < columnB;
}
};
}
Expand Down

0 comments on commit e0007d1

Please sign in to comment.