Skip to content

Commit

Permalink
src: fix FastStringKey equal operator
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
sapics authored and jasnell committed Jun 24, 2020
1 parent d4a1c98 commit 5a0c6a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -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)
Expand Down

0 comments on commit 5a0c6a6

Please sign in to comment.