util/StringAPI: add strpbrk() wrapper

This commit is contained in:
Max Kellermann 2018-07-18 15:59:41 +02:00
parent 998227cffc
commit 6448b31b11
2 changed files with 14 additions and 0 deletions

View File

@ -94,6 +94,13 @@ StringFindLast(char *haystack, char needle) noexcept
return strrchr(haystack, needle);
}
gcc_pure gcc_nonnull_all
static inline const char *
StringFindAny(const char *haystack, const char *accept) noexcept
{
return strpbrk(haystack, accept);
}
static inline char *
StringToken(char *str, const char *delim) noexcept
{

View File

@ -90,6 +90,13 @@ StringFindLast(wchar_t *haystack, wchar_t needle) noexcept
return wcsrchr(haystack, needle);
}
gcc_pure gcc_nonnull_all
static inline const wchar_t *
StringFindAny(const wchar_t *haystack, const wchar_t *accept) noexcept
{
return wcspbrk(haystack, accept);
}
gcc_nonnull_all
static inline void
UnsafeCopyString(wchar_t *dest, const wchar_t *src) noexcept