mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibC: Add wcsncmp()
Taken from strncmp(), like wcscmp() in ef40ebb
. :^)
This commit is contained in:
parent
2cc3d68615
commit
ec42f864d4
Notes:
sideshowbarker
2024-07-18 23:06:51 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/ec42f864d4a Pull-request: https://github.com/SerenityOS/serenity/pull/5001 Reviewed-by: https://github.com/alimpfard
2 changed files with 14 additions and 0 deletions
|
@ -61,6 +61,19 @@ int wcscmp(const wchar_t* s1, const wchar_t* s2)
|
|||
return *(const wchar_t*)s1 - *(const wchar_t*)--s2;
|
||||
}
|
||||
|
||||
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n)
|
||||
{
|
||||
if (!n)
|
||||
return 0;
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return *(const wchar_t*)s1 - *(const wchar_t*)--s2;
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n);
|
||||
return 0;
|
||||
}
|
||||
|
||||
wchar_t* wcschr(const wchar_t* str, int c)
|
||||
{
|
||||
wchar_t ch = c;
|
||||
|
|
|
@ -39,6 +39,7 @@ size_t wcslen(const wchar_t*);
|
|||
wchar_t* wcscpy(wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
||||
int wcscmp(const wchar_t*, const wchar_t*);
|
||||
int wcsncmp(const wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wcschr(const wchar_t*, int);
|
||||
const wchar_t* wcsrchr(const wchar_t*, wchar_t);
|
||||
wchar_t* wcscat(wchar_t*, const wchar_t*);
|
||||
|
|
Loading…
Reference in a new issue