Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions src/string_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
}

Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down