bits/syscall.h: add landlock syscalls from linux v5.13
[musl.git] / src / locale / wcsxfrm.c
blob05e3e1158188e51013b986513e517dfd14866106
1 #include <wchar.h>
2 #include <locale.h>
3 #include "locale_impl.h"
5 /* collate only by code points */
6 size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc)
8 size_t l = wcslen(src);
9 if (l < n) {
10 wmemcpy(dest, src, l+1);
11 } else if (n) {
12 wmemcpy(dest, src, n-1);
13 dest[n-1] = 0;
15 return l;
18 size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n)
20 return __wcsxfrm_l(dest, src, n, CURRENT_LOCALE);
23 weak_alias(__wcsxfrm_l, wcsxfrm_l);