Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix FastStringKey equal operator #33748

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/util-inl.h
Expand Up @@ -303,7 +303,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 @@ -536,9 +536,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 @@ -554,7 +554,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