diff options
Diffstat (limited to 'libc-top-half/musl/src/locale/wcsxfrm.c')
-rw-r--r-- | libc-top-half/musl/src/locale/wcsxfrm.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/locale/wcsxfrm.c b/libc-top-half/musl/src/locale/wcsxfrm.c new file mode 100644 index 0000000..05e3e11 --- /dev/null +++ b/libc-top-half/musl/src/locale/wcsxfrm.c @@ -0,0 +1,23 @@ +#include <wchar.h> +#include <locale.h> +#include "locale_impl.h" + +/* collate only by code points */ +size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc) +{ + size_t l = wcslen(src); + if (l < n) { + wmemcpy(dest, src, l+1); + } else if (n) { + wmemcpy(dest, src, n-1); + dest[n-1] = 0; + } + return l; +} + +size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n) +{ + return __wcsxfrm_l(dest, src, n, CURRENT_LOCALE); +} + +weak_alias(__wcsxfrm_l, wcsxfrm_l); |