mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
LibC: Add wcsncmp()
Taken from strncmp(), like wcscmp() in ef40ebb
. :^)
This commit is contained in:
parent
2cc3d68615
commit
ec42f864d4
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;
|
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* wcschr(const wchar_t* str, int c)
|
||||||
{
|
{
|
||||||
wchar_t ch = 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* wcscpy(wchar_t*, const wchar_t*);
|
||||||
wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
||||||
int wcscmp(const wchar_t*, const wchar_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);
|
wchar_t* wcschr(const wchar_t*, int);
|
||||||
const wchar_t* wcsrchr(const wchar_t*, wchar_t);
|
const wchar_t* wcsrchr(const wchar_t*, wchar_t);
|
||||||
wchar_t* wcscat(wchar_t*, const wchar_t*);
|
wchar_t* wcscat(wchar_t*, const wchar_t*);
|
||||||
|
|
Loading…
Add table
Reference in a new issue