mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-12 21:35:12 +03:00
LibC: Implement wmemcmp
This commit is contained in:
parent
685045176b
commit
57f0c12b9a
Notes:
sideshowbarker
2024-07-18 02:15:46 +09:00
Author: https://github.com/BertalanD Commit: https://github.com/SerenityOS/serenity/commit/57f0c12b9a7 Pull-request: https://github.com/SerenityOS/serenity/pull/9378 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/itamar8910 Reviewed-by: https://github.com/linusg ✅ Reviewed-by: https://github.com/nico Reviewed-by: https://github.com/timschumi
@ -541,4 +541,13 @@ size_t mbsrtowcs(wchar_t* dst, const char** src, size_t len, mbstate_t* ps)
|
||||
// If we are here, we have written `len` wchars, but not reached the null byte.
|
||||
return written;
|
||||
}
|
||||
|
||||
int wmemcmp(const wchar_t* s1, const wchar_t* s2, size_t n)
|
||||
{
|
||||
while (n-- > 0) {
|
||||
if (*s1++ != *s2++)
|
||||
return s1[-1] < s2[-1] ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -60,5 +60,6 @@ int swprintf(wchar_t*, size_t, const wchar_t*, ...);
|
||||
int wcwidth(wchar_t);
|
||||
size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*);
|
||||
size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*);
|
||||
int wmemcmp(const wchar_t*, const wchar_t*, size_t);
|
||||
|
||||
__END_DECLS
|
||||
|
Loading…
Reference in New Issue
Block a user