1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 10:47:34 +00:00

LibC: Implement wmemchr

This commit is contained in:
Tim Schumacher 2021-09-22 08:56:34 +00:00 committed by Brian Gianforcaro
parent 5ac2e84264
commit 0ca1df4dc6
3 changed files with 43 additions and 0 deletions

View file

@ -375,4 +375,14 @@ wchar_t* wcsstr(const wchar_t* haystack, const wchar_t* needle)
return nullptr;
}
wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n)
{
for (size_t i = 0; i < n; i++) {
if (s[i] == c)
return const_cast<wchar_t*>(&s[i]);
}
return nullptr;
}
}

View file

@ -43,5 +43,6 @@ int wctob(wint_t);
int mbsinit(const mbstate_t*);
wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
wchar_t* wcsstr(const wchar_t*, const wchar_t*);
wchar_t* wmemchr(const wchar_t*, wchar_t, size_t);
__END_DECLS