Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor FindCmdDlg - invert if to reduce nesting.

  • Loading branch information...
commit a4997eab9673336c2db59dae15f6a9a5fdb29a7b 1 parent 7f7a76c
@adamv adamv authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/FindCmdDlg.cpp
View
12 src/FindCmdDlg.cpp
@@ -249,11 +249,11 @@ FindCmdDlg::ActionList::aItem::aItem(const tmAction* a, const vector<unsigned in
: action(a), hlChars(hl) {
// Calculate rank (total distance between chars)
rank = 0;
- if (hlChars.size() > 1) {
- unsigned int prev = hlChars[0]+1;
- for (vector<unsigned int>::const_iterator p = hlChars.begin()+1; p != hlChars.end(); ++p) {
- rank += *p - prev;
- prev = *p+1;
- }
+ if (hlChars.size() <= 1) return;
+
+ unsigned int prev = hlChars[0]+1;
+ for (vector<unsigned int>::const_iterator p = hlChars.begin()+1; p != hlChars.end(); ++p) {
+ rank += *p - prev;
+ prev = *p+1;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.