From: Rich Felker Date: Wed, 24 Jul 2013 22:44:31 +0000 (-0400) Subject: update strxfrm/wcsxfrm for future LC_COLLATE support and ABI compat X-Git-Tag: v0.9.12~21 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ad4a536769b5d4a736e324a7416571b0c17e47b9;p=oweals%2Fmusl.git update strxfrm/wcsxfrm for future LC_COLLATE support and ABI compat --- 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 +#include +#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 - -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 +#include +#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 - -size_t wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t locale) -{ - return wcsxfrm(dest, src, n); -}