Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cf0928c

Browse filesBrowse files
mscdexevanlucas
authored andcommitted
src: clean up string_search
This commit removes some unnecessary signed checks on unsigned variables and removes a few unused private functions. PR-URL: #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>
1 parent d71ede8 commit cf0928c
Copy full SHA for cf0928c

File tree

Expand file treeCollapse file tree

1 file changed

+3
-15
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-15
lines changed
Open diff view settings
Collapse file

‎src/string_search.h‎

Copy file name to clipboardExpand all lines: src/string_search.h
+3-15Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Vector {
4444

4545
// Access individual vector elements - checks bounds in debug mode.
4646
T& operator[](size_t index) const {
47-
ASSERT(0 <= index && index < length_);
47+
ASSERT(index < length_);
4848
return start_[is_forward_ ? index : (length_ - index - 1)];
4949
}
5050

@@ -139,12 +139,6 @@ class StringSearch : private StringSearchBase {
139139
Vector<const Char>,
140140
size_t);
141141

142-
static size_t FailSearch(StringSearch<Char>*,
143-
Vector<const Char> subject,
144-
size_t) {
145-
return subject.length();
146-
}
147-
148142
static size_t SingleCharSearch(StringSearch<Char>* search,
149143
Vector<const Char> subject,
150144
size_t start_index);
@@ -170,12 +164,6 @@ class StringSearch : private StringSearchBase {
170164

171165
void PopulateBoyerMooreTable();
172166

173-
static inline bool exceedsOneByte(uint8_t c) { return false; }
174-
175-
static inline bool exceedsOneByte(uint16_t c) {
176-
return c > kMaxOneByteCharCodeU;
177-
}
178-
179167
static inline int CharOccurrence(int* bad_char_occurrence,
180168
Char char_code) {
181169
if (sizeof(Char) == 1) {
@@ -401,7 +389,7 @@ size_t StringSearch<Char>::BoyerMooreSearch(
401389
return subject.length();
402390
}
403391
}
404-
while (j >= 0 && pattern[j] == (c = subject[index + j])) {
392+
while (pattern[j] == (c = subject[index + j])) {
405393
if (j == 0) {
406394
return index;
407395
}
@@ -529,7 +517,7 @@ size_t StringSearch<Char>::BoyerMooreHorspoolSearch(
529517
}
530518
}
531519
j--;
532-
while (j >= 0 && pattern[j] == (subject[index + j])) {
520+
while (pattern[j] == (subject[index + j])) {
533521
if (j == 0) {
534522
return index;
535523
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.