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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
sapics authored and codebytere committed Jun 30, 2020
1 parent a0d6219 commit 0190cf6
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 0190cf6

Please sign in to comment.