summaryrefslogtreecommitdiff
path: root/src/string_search.h
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2016-06-06 00:57:25 -0400
committerBrian White <mscdex@mscdex.net>2016-06-14 16:10:21 -0400
commitf914f37742a1d22c70cc650b720739b1f25d3cf3 (patch)
tree626accae10f2e6652502e480d99e4aff8c6f7a52 /src/string_search.h
parent686984696de00ce09ac1d56e997cf705ecb6377d (diff)
downloadandroid-node-v8-f914f37742a1d22c70cc650b720739b1f25d3cf3.tar.gz
android-node-v8-f914f37742a1d22c70cc650b720739b1f25d3cf3.tar.bz2
android-node-v8-f914f37742a1d22c70cc650b720739b1f25d3cf3.zip
src: clean up string_search
This commit removes some unnecessary signed checks on unsigned variables and removes a few unused private functions. 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>
Diffstat (limited to 'src/string_search.h')
-rw-r--r--src/string_search.h18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/string_search.h b/src/string_search.h
index b60457da2a..7827fe153e 100644
--- a/src/string_search.h
+++ b/src/string_search.h
@@ -44,7 +44,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_[is_forward_ ? index : (length_ - index - 1)];
}
@@ -139,12 +139,6 @@ class StringSearch : private StringSearchBase {
Vector<const Char>,
size_t);
- static size_t FailSearch(StringSearch<Char>*,
- Vector<const Char> subject,
- size_t) {
- return subject.length();
- }
-
static size_t SingleCharSearch(StringSearch<Char>* search,
Vector<const Char> subject,
size_t start_index);
@@ -170,12 +164,6 @@ class StringSearch : private StringSearchBase {
void PopulateBoyerMooreTable();
- static inline bool exceedsOneByte(uint8_t c) { return false; }
-
- static inline bool exceedsOneByte(uint16_t c) {
- return c > kMaxOneByteCharCodeU;
- }
-
static inline int CharOccurrence(int* bad_char_occurrence,
Char char_code) {
if (sizeof(Char) == 1) {
@@ -401,7 +389,7 @@ size_t StringSearch<Char>::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;
}
@@ -529,7 +517,7 @@ size_t StringSearch<Char>::BoyerMooreHorspoolSearch(
}
}
j--;
- while (j >= 0 && pattern[j] == (subject[index + j])) {
+ while (pattern[j] == (subject[index + j])) {
if (j == 0) {
return index;
}