[libc-commits] [libc] [libc] Stop duplicating wcschr(). (PR #150661)
via libc-commits
libc-commits at lists.llvm.org
Fri Jul 25 10:23:01 PDT 2025
================
@@ -11,15 +11,12 @@
#include "hdr/types/wchar_t.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
+#include "wchar_utils.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(const wchar_t *, wcschr, (const wchar_t *s, wchar_t c)) {
- for (; *s && *s != c; ++s)
- ;
- if (*s == c)
- return s;
- return nullptr;
+ return internal::wcschr(s, c);
----------------
lntue wrote:
since you are here, can you add `LIBC_CRASH_ON_NULLPTR(s);` and its header+dependency?
https://github.com/llvm/llvm-project/pull/150661
More information about the libc-commits
mailing list