From d86332799ca0820f204ed38707b05c12b61fd7f5 Mon Sep 17 00:00:00 2001 From: Brian White Date: Tue, 12 Jul 2016 12:20:46 -0400 Subject: [PATCH] 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 Reviewed-By: Ben Noordhuis Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/string_search.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/string_search.h b/src/string_search.h index 01dbf9156e..4d61548fe2 100644 --- a/src/string_search.h +++ b/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::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::BoyerMooreHorspoolSearch( } } j--; - while (j >= 0 && pattern[j] == (subject[index + j])) { + while (pattern[j] == (subject[index + j])) { if (j == 0) { return index; }