diff options
author | sapics <gv.nishino@gmail.com> | 2020-06-05 15:50:03 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2020-06-25 02:29:37 +0300 |
commit | 5a0c6a6b5dbcb97a0f0fcd38df46cf8f090c1271 (patch) | |
tree | 366750b0e7d79965c31f32a38712fb9799516f27 /src/util-inl.h | |
parent | d4a1c98a54b462a947f6f0e433852b43c40dd282 (diff) |
src: fix FastStringKey equal operator
PR-URL: https://github.com/nodejs/node/pull/33748
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'src/util-inl.h')
-rw-r--r-- | src/util-inl.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util-inl.h b/src/util-inl.h index 1af87d492ad..5276fbef07f 100644 --- a/src/util-inl.h +++ b/src/util-inl.h @@ -300,7 +300,7 @@ bool StringEqualNoCase(const char* a, const char* b) { if (*a == '\0') return *b == '\0'; if (*b == '\0') - return *a == '\0'; + return false; } while (ToLower(*a++) == ToLower(*b++)); return false; } @@ -533,9 +533,9 @@ inline bool IsSafeJsInt(v8::Local<v8::Value> v) { constexpr size_t FastStringKey::HashImpl(const char* str) { // Low-quality hash (djb2), but just fine for current use cases. size_t h = 5381; - do { - h = h * 33 + *str; // NOLINT(readability/pointer_notation) - } while (*(str++) != '\0'); + while (*str != '\0') { + h = h * 33 + *(str++); // NOLINT(readability/pointer_notation) + } return h; } @@ -551,7 +551,7 @@ constexpr bool FastStringKey::operator==(const FastStringKey& other) const { do { if (*(p1++) != *(p2++)) return false; } while (*p1 != '\0'); - return true; + return *p2 == '\0'; } constexpr FastStringKey::FastStringKey(const char* name) |