Browse Source

src: clean up string_search

This commit removes some unnecessary signed checks on unsigned
variables.

PR-URL: https://github.com/nodejs/node/pull/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>
v4.x
Brian White 9 years ago
committed by Myles Borins
parent
commit
d86332799c
  1. 6
      src/string_search.h

6
src/string_search.h

@ -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];
}
@ -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;
}
@ -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;
}

Loading…
Cancel
Save