diff options
author | Rich Felker <dalias@aerifal.cx> | 2013-07-24 18:44:31 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2013-07-24 18:44:31 -0400 |
commit | ad4a536769b5d4a736e324a7416571b0c17e47b9 (patch) | |
tree | 7d707e391e629d7c5c0446b8dfc03a956299fb01 /src/locale | |
parent | 4350935ca4521b647472b8c18053325e07541ba1 (diff) | |
download | musl-ad4a536769b5d4a736e324a7416571b0c17e47b9.tar.gz musl-ad4a536769b5d4a736e324a7416571b0c17e47b9.tar.bz2 musl-ad4a536769b5d4a736e324a7416571b0c17e47b9.tar.xz musl-ad4a536769b5d4a736e324a7416571b0c17e47b9.zip |
update strxfrm/wcsxfrm for future LC_COLLATE support and ABI compat
Diffstat (limited to 'src/locale')
-rw-r--r-- | src/locale/strxfrm.c | 11 | ||||
-rw-r--r-- | src/locale/strxfrm_l.c | 6 | ||||
-rw-r--r-- | src/locale/wcsxfrm.c | 11 | ||||
-rw-r--r-- | src/locale/wcsxfrm_l.c | 6 |
4 files changed, 20 insertions, 14 deletions
diff --git a/src/locale/strxfrm.c b/src/locale/strxfrm.c index d40be9e1..0ca9b071 100644 --- a/src/locale/strxfrm.c +++ b/src/locale/strxfrm.c @@ -1,9 +1,18 @@ #include <string.h> +#include <locale.h> +#include "libc.h" /* collate only by code points */ -size_t strxfrm(char *restrict dest, const char *restrict src, size_t n) +size_t __strxfrm_l(char *restrict dest, const char *restrict src, size_t n, locale_t loc) { size_t l = strlen(src); if (n > l) strcpy(dest, src); return l; } + +size_t strxfrm(char *restrict dest, const char *restrict src, size_t n) +{ + return __strxfrm_l(dest, src, n, LC_GLOBAL_LOCALE); +} + +weak_alias(__strxfrm_l, strxfrm_l); diff --git a/src/locale/strxfrm_l.c b/src/locale/strxfrm_l.c deleted file mode 100644 index 81a7badf..00000000 --- a/src/locale/strxfrm_l.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <string.h> - -size_t strxfrm_l(char *restrict dest, const char *restrict src, size_t n, locale_t l) -{ - return strxfrm(dest, src, n); -} diff --git a/src/locale/wcsxfrm.c b/src/locale/wcsxfrm.c index bfa01b5b..f977f9e1 100644 --- a/src/locale/wcsxfrm.c +++ b/src/locale/wcsxfrm.c @@ -1,7 +1,9 @@ #include <wchar.h> +#include <locale.h> +#include "libc.h" /* collate only by code points */ -size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict 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); if (l >= n) { @@ -10,3 +12,10 @@ size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n) } else wcscpy(dest, src); return l; } + +size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n) +{ + return __wcsxfrm_l(dest, src, n, LC_GLOBAL_LOCALE); +} + +weak_alias(__wcsxfrm_l, wcsxfrm_l); diff --git a/src/locale/wcsxfrm_l.c b/src/locale/wcsxfrm_l.c deleted file mode 100644 index 66a00193..00000000 --- a/src/locale/wcsxfrm_l.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <wchar.h> - -size_t wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t locale) -{ - return wcsxfrm(dest, src, n); -} |