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 d863327

Browse filesBrowse files
mscdexMyles Borins
authored andcommitted
src: clean up string_search
This commit removes some unnecessary signed checks on unsigned variables. 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 6562444 commit d863327
Copy full SHA for d863327

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎src/string_search.h‎

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

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

@@ -416,7 +416,7 @@ size_t StringSearch<PatternChar, SubjectChar>::BoyerMooreSearch(
416416
return subject.length();
417417
}
418418
}
419-
while (j >= 0 && pattern[j] == (c = subject[index + j])) {
419+
while (pattern[j] == (c = subject[index + j])) {
420420
if (j == 0) {
421421
return index;
422422
}
@@ -544,7 +544,7 @@ size_t StringSearch<PatternChar, SubjectChar>::BoyerMooreHorspoolSearch(
544544
}
545545
}
546546
j--;
547-
while (j >= 0 && pattern[j] == (subject[index + j])) {
547+
while (pattern[j] == (subject[index + j])) {
548548
if (j == 0) {
549549
return index;
550550
}

0 commit comments

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