From 52e2130d51e0fb5cdeb17cbf2d455d9e65436dd7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Oct 2024 13:44:10 +0200 Subject: [PATCH] util/StringCompare: simplify StringIsEqual() using operator== --- src/util/StringCompare.hxx | 3 +-- src/util/WStringCompare.hxx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/StringCompare.hxx b/src/util/StringCompare.hxx index 579752187..e64cedb9b 100644 --- a/src/util/StringCompare.hxx +++ b/src/util/StringCompare.hxx @@ -22,8 +22,7 @@ StringIsEmpty(const char *string) noexcept static inline bool StringIsEqual(std::string_view a, std::string_view b) noexcept { - return a.size() == b.size() && - StringIsEqual(a.data(), b.data(), b.size()); + return a == b; } [[gnu::pure]] diff --git a/src/util/WStringCompare.hxx b/src/util/WStringCompare.hxx index 91fd84f5b..390e1cdcc 100644 --- a/src/util/WStringCompare.hxx +++ b/src/util/WStringCompare.hxx @@ -21,8 +21,7 @@ StringIsEmpty(const wchar_t *string) noexcept static inline bool StringIsEqual(std::wstring_view a, std::wstring_view b) noexcept { - return a.size() == b.size() && - StringIsEqual(a.data(), b.data(), b.size()); + return a == b; } [[gnu::pure]]