Commit b5d1a090 authored by Max Kellermann's avatar Max Kellermann

util/StringUtil: pass std::string_view to StringArrayContainsCase()

parent 85b072b3
......@@ -18,35 +18,19 @@
*/
#include "StringUtil.hxx"
#include "StringView.hxx"
#include "StringCompare.hxx"
#include "CharUtil.hxx"
#include "ASCII.hxx"
#include <cassert>
bool
StringArrayContainsCase(const char *const*haystack,
const char *needle) noexcept
std::string_view needle) noexcept
{
assert(haystack != nullptr);
assert(needle != nullptr);
for (; *haystack != nullptr; ++haystack)
if (StringEqualsCaseASCII(*haystack, needle))
return true;
return false;
}
bool
StringArrayContainsCase(const char *const*haystack,
StringView needle) noexcept
{
assert(haystack != nullptr);
assert(needle != nullptr);
for (; *haystack != nullptr; ++haystack)
if (needle.EqualsIgnoreCase(*haystack))
if (StringIsEqualIgnoreCase(*haystack, needle))
return true;
return false;
......
......@@ -23,8 +23,7 @@
#include "Compiler.h"
#include <cstddef>
struct StringView;
#include <string_view>
/**
* Checks whether a string array contains the specified string.
......@@ -37,12 +36,7 @@ struct StringView;
gcc_pure
bool
StringArrayContainsCase(const char *const*haystack,
const char *needle) noexcept;
gcc_pure
bool
StringArrayContainsCase(const char *const*haystack,
StringView needle) noexcept;
std::string_view needle) noexcept;
/**
* Convert the specified ASCII string (0x00..0x7f) to upper case.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment