util/StringCompare: simplify StringIsEqual() using operator==

This commit is contained in:
Max Kellermann 2024-10-21 13:44:10 +02:00 committed by Max Kellermann
parent 1930ed16cb
commit 52e2130d51
2 changed files with 2 additions and 4 deletions

View File

@ -22,8 +22,7 @@ StringIsEmpty(const char *string) noexcept
static inline bool static inline bool
StringIsEqual(std::string_view a, std::string_view b) noexcept StringIsEqual(std::string_view a, std::string_view b) noexcept
{ {
return a.size() == b.size() && return a == b;
StringIsEqual(a.data(), b.data(), b.size());
} }
[[gnu::pure]] [[gnu::pure]]

View File

@ -21,8 +21,7 @@ StringIsEmpty(const wchar_t *string) noexcept
static inline bool static inline bool
StringIsEqual(std::wstring_view a, std::wstring_view b) noexcept StringIsEqual(std::wstring_view a, std::wstring_view b) noexcept
{ {
return a.size() == b.size() && return a == b;
StringIsEqual(a.data(), b.data(), b.size());
} }
[[gnu::pure]] [[gnu::pure]]