From ad4a536769b5d4a736e324a7416571b0c17e47b9 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 24 Jul 2013 18:44:31 -0400 Subject: update strxfrm/wcsxfrm for future LC_COLLATE support and ABI compat --- src/locale/strxfrm.c | 11 ++++++++++- src/locale/strxfrm_l.c | 6 ------ src/locale/wcsxfrm.c | 11 ++++++++++- src/locale/wcsxfrm_l.c | 6 ------ 4 files changed, 20 insertions(+), 14 deletions(-) delete mode 100644 src/locale/strxfrm_l.c delete mode 100644 src/locale/wcsxfrm_l.c (limited to 'src/locale') 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); -} -- cgit v1.2.3-70-g09d2