LibC: Allow searching null char with wcschr

This commit is contained in:
Bananymous 2025-06-16 15:09:55 +03:00
parent 7ff7a4aa87
commit 7651ca747d
1 changed files with 2 additions and 0 deletions

View File

@ -254,6 +254,8 @@ size_t wcscspn(const wchar_t* ws1, const wchar_t* ws2)
wchar_t* wcschr(const wchar_t* ws, wchar_t wc) wchar_t* wcschr(const wchar_t* ws, wchar_t wc)
{ {
if (wc == L'\0')
return const_cast<wchar_t*>(ws + wcslen(ws));
for (size_t i = 0; ws[i]; i++) for (size_t i = 0; ws[i]; i++)
if (ws[i] == wc) if (ws[i] == wc)
return const_cast<wchar_t*>(&ws[i]); return const_cast<wchar_t*>(&ws[i]);