From b745d1f226966d4f15c8ef3825d539527aa175de Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 21 Oct 2024 13:40:48 +0200 Subject: [PATCH] util/StringCompare: add `constexpr` --- src/util/StringCompare.hxx | 6 +++--- src/util/WStringCompare.hxx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/StringCompare.hxx b/src/util/StringCompare.hxx index e64cedb9b..363aab690 100644 --- a/src/util/StringCompare.hxx +++ b/src/util/StringCompare.hxx @@ -19,7 +19,7 @@ StringIsEmpty(const char *string) noexcept } [[gnu::pure]] -static inline bool +static constexpr bool StringIsEqual(std::string_view a, std::string_view b) noexcept { return a == b; @@ -112,7 +112,7 @@ const char * FindStringSuffix(const char *p, const char *suffix) noexcept; template -bool +constexpr bool SkipPrefix(std::basic_string_view &haystack, std::basic_string_view needle) noexcept { @@ -123,7 +123,7 @@ SkipPrefix(std::basic_string_view &haystack, } template -bool +constexpr bool RemoveSuffix(std::basic_string_view &haystack, std::basic_string_view needle) noexcept { diff --git a/src/util/WStringCompare.hxx b/src/util/WStringCompare.hxx index 390e1cdcc..ceb5d595f 100644 --- a/src/util/WStringCompare.hxx +++ b/src/util/WStringCompare.hxx @@ -11,14 +11,14 @@ #include [[gnu::pure]] [[gnu::nonnull]] -static inline bool +static constexpr bool StringIsEmpty(const wchar_t *string) noexcept { return *string == 0; } [[gnu::pure]] -static inline bool +static constexpr bool StringIsEqual(std::wstring_view a, std::wstring_view b) noexcept { return a == b;