Skip to content

Commit

Permalink
src: clean up string_search
Browse files Browse the repository at this point in the history
This commit removes some unnecessary signed checks on unsigned
variables.

PR-URL: nodejs#7174
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mscdex committed Jul 12, 2016
1 parent ce8dbbb commit 13abb8d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/string_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Vector {

// Access individual vector elements - checks bounds in debug mode.
T& operator[](size_t index) const {
ASSERT(0 <= index && index < length_);
ASSERT(index < length_);
return start_[index];
}

Expand Down Expand Up @@ -416,7 +416,7 @@ size_t StringSearch<PatternChar, SubjectChar>::BoyerMooreSearch(
return subject.length();
}
}
while (j >= 0 && pattern[j] == (c = subject[index + j])) {
while (pattern[j] == (c = subject[index + j])) {
if (j == 0) {
return index;
}
Expand Down Expand Up @@ -544,7 +544,7 @@ size_t StringSearch<PatternChar, SubjectChar>::BoyerMooreHorspoolSearch(
}
}
j--;
while (j >= 0 && pattern[j] == (subject[index + j])) {
while (pattern[j] == (subject[index + j])) {
if (j == 0) {
return index;
}
Expand Down

0 comments on commit 13abb8d

Please sign in to comment.