diff options
| author | Jessica Clarke <jrtc27@jrtc27.com> | 2025-07-30 17:10:46 +0100 |
|---|---|---|
| committer | Jessica Clarke <jrtc27@jrtc27.com> | 2025-07-30 17:10:46 +0100 |
| commit | 66393c8ec645d9121f2b3e53708b0379a113aa02 (patch) | |
| tree | f2a740bc8ada2dde8506ea87bb6014a9b3722433 /libc/src/wchar/wcsspn.cpp | |
| parent | 7e3a1d92899336f57a6af737c9641468a1dd19b3 (diff) | |
| parent | 3e93964b896023b1006d3c878effb68203d4d8dd (diff) | |
Created using spr 1.3.5
Diffstat (limited to 'libc/src/wchar/wcsspn.cpp')
| -rw-r--r-- | libc/src/wchar/wcsspn.cpp | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/libc/src/wchar/wcsspn.cpp b/libc/src/wchar/wcsspn.cpp index 23de381a2d95..ae2cf5a41ae4 100644 --- a/libc/src/wchar/wcsspn.cpp +++ b/libc/src/wchar/wcsspn.cpp @@ -12,23 +12,15 @@ #include "hdr/types/wchar_t.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/__support/macros/null_check.h" +#include "wchar_utils.h" namespace LIBC_NAMESPACE_DECL { -bool check(wchar_t c, const wchar_t *s2) { - for (int n = 0; s2[n]; ++n) { - if (s2[n] == c) - return true; - } - return false; -} LLVM_LIBC_FUNCTION(size_t, wcsspn, (const wchar_t *s1, const wchar_t *s2)) { - size_t i = 0; - for (; s1[i]; ++i) { - if (!check(s1[i], s2)) - return i; - } - return i; + LIBC_CRASH_ON_NULLPTR(s1); + LIBC_CRASH_ON_NULLPTR(s2); + return internal::wcsspn(s1, s2, /*not_match_set=*/false); } } // namespace LIBC_NAMESPACE_DECL |
