projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use inline syscalls for powerpc (32-bit)
[musl]
/
src
/
locale
/
wcsxfrm.c
diff --git
a/src/locale/wcsxfrm.c
b/src/locale/wcsxfrm.c
index
5f76e5a
..
05e3e11
100644
(file)
--- a/
src/locale/wcsxfrm.c
+++ b/
src/locale/wcsxfrm.c
@@
-1,12
+1,23
@@
#include <wchar.h>
#include <wchar.h>
+#include <locale.h>
+#include "locale_impl.h"
/* collate only by code points */
/* collate only by code points */
-size_t
wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n
)
+size_t
__wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc
)
{
size_t l = wcslen(src);
{
size_t l = wcslen(src);
- if (l >= n) {
+ if (l < n) {
+ wmemcpy(dest, src, l+1);
+ } else if (n) {
wmemcpy(dest, src, n-1);
dest[n-1] = 0;
wmemcpy(dest, src, n-1);
dest[n-1] = 0;
- }
else wcscpy(dest, src);
+ }
return l;
}
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);