• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <wchar.h>
2 #include <locale.h>
3 #include "locale_impl.h"
4 
5 /* collate only by code points */
__wcsxfrm_l(wchar_t * restrict dest,const wchar_t * restrict src,size_t n,locale_t loc)6 size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc)
7 {
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;
14 	}
15 	return l;
16 }
17 
wcsxfrm(wchar_t * restrict dest,const wchar_t * restrict src,size_t n)18 size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n)
19 {
20 	return __wcsxfrm_l(dest, src, n, CURRENT_LOCALE);
21 }
22 
23 weak_alias(__wcsxfrm_l, wcsxfrm_l);
24