diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-18 15:59:41 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-18 16:51:29 +0200 |
commit | 6448b31b11f54cf46a81a6651ff5f15ab6b06656 (patch) | |
tree | a6bb597c7c7524e9fffb1f73bb2b10eb3c0663a0 /src/util | |
parent | 998227cffc5a6454a238c4fd814161c38a3e3823 (diff) |
util/StringAPI: add strpbrk() wrapper
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/StringAPI.hxx | 7 | ||||
-rw-r--r-- | src/util/WStringAPI.hxx | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/util/StringAPI.hxx b/src/util/StringAPI.hxx index b94a4566f..febaabbc7 100644 --- a/src/util/StringAPI.hxx +++ b/src/util/StringAPI.hxx @@ -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 { diff --git a/src/util/WStringAPI.hxx b/src/util/WStringAPI.hxx index 6e3aa204d..efe8205ea 100644 --- a/src/util/WStringAPI.hxx +++ b/src/util/WStringAPI.hxx @@ -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 |