diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2017-07-25 13:20:40 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2017-07-27 18:11:08 +0300 |
commit | 1b7372f2fb55f704b885e1097e2ec0381068c855 (patch) | |
tree | fe5ca729487cca97831c5bbd6edafd280a9c5814 /src/string_search.h | |
parent | 1fa67c7fc2ef9fc226545f5de22c51964dbc27e1 (diff) |
src: replace ASSERT with CHECK
Builds always have asserts enabled so there is no point distinguishing
between debug-only checks and run-time checks. Replace calls to ASSERT
and friends with their CHECK counterparts.
Fixes: https://github.com/nodejs/node/issues/14461
PR-URL: https://github.com/nodejs/node/pull/14474
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: XadillaX <admin@xcoder.in>
Diffstat (limited to 'src/string_search.h')
-rw-r--r-- | src/string_search.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/string_search.h b/src/string_search.h index 6040888110c..dfdb8e9a160 100644 --- a/src/string_search.h +++ b/src/string_search.h @@ -28,7 +28,7 @@ class Vector { public: Vector(T* data, size_t length, bool isForward) : start_(data), length_(length), is_forward_(isForward) { - ASSERT(length > 0 && data != nullptr); + CHECK(length > 0 && data != nullptr); } // Returns the start of the memory range. @@ -44,7 +44,7 @@ class Vector { // Access individual vector elements - checks bounds in debug mode. T& operator[](size_t index) const { - ASSERT(index < length_); + CHECK(index < length_); return start_[is_forward_ ? index : (length_ - index - 1)]; } @@ -342,7 +342,7 @@ size_t StringSearch<Char>::LinearSearch( i = FindFirstCharacter(pattern, subject, i); if (i == subject.length()) return subject.length(); - ASSERT_LE(i, n); + CHECK_LE(i, n); bool matches = true; for (size_t j = 1; j < pattern_length; j++) { @@ -591,7 +591,7 @@ size_t StringSearch<Char>::InitialSearch( i = FindFirstCharacter(pattern, subject, i); if (i == subject.length()) return subject.length(); - ASSERT_LE(i, n); + CHECK_LE(i, n); size_t j = 1; do { if (pattern[j] != subject[i + j]) { @@ -644,7 +644,7 @@ size_t SearchString(const Char* haystack, needle, needle_length, is_forward); Vector<const Char> v_haystack = Vector<const Char>( haystack, haystack_length, is_forward); - ASSERT(haystack_length >= needle_length); + CHECK(haystack_length >= needle_length); size_t diff = haystack_length - needle_length; size_t relative_start_index; if (is_forward) { |