From 238455adfab4f8070ac65400aac22bb8a9e502fc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 10 Aug 2016 16:30:46 +0200 Subject: Implement strto[dflu]_l/wcsto[dflu]_l Implement GNU extensions strtod_l, strtof_l, strtol_l, strtold_l, strtoll_l, strtoul_l, strtoull_l, wcstod_l, wcstof_l, wcstol_l, wcstold_l, wcstoll_l, wcstoul_l, wcstoull_l. Export from Cygwin, fix posix.xml. Signed-off-by: Corinna Vinschen --- newlib/libc/stdlib/wcsnrtombs.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'newlib/libc/stdlib/wcsnrtombs.c') diff --git a/newlib/libc/stdlib/wcsnrtombs.c b/newlib/libc/stdlib/wcsnrtombs.c index b09f7e19e..8ad8bcd2c 100644 --- a/newlib/libc/stdlib/wcsnrtombs.c +++ b/newlib/libc/stdlib/wcsnrtombs.c @@ -103,15 +103,11 @@ PORTABILITY #include #include #include "local.h" +#include "../locale/setlocale.h" size_t -_DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), - struct _reent *r _AND - char *dst _AND - const wchar_t **src _AND - size_t nwc _AND - size_t len _AND - mbstate_t *ps) +_wcsnrtombs_l (struct _reent *r, char *dst, const wchar_t **src, size_t nwc, + size_t len, mbstate_t *ps, locale_t loc) { char *ptr = dst; char buff[10]; @@ -138,7 +134,7 @@ _DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), { int count = ps->__count; wint_t wch = ps->__value.__wch; - int bytes = __WCTOMB (r, buff, *pwcs, ps); + int bytes = loc->wctomb (r, buff, *pwcs, ps); if (bytes == -1) { r->_errno = EILSEQ; @@ -174,6 +170,19 @@ _DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), return n; } +size_t +_DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), + struct _reent *r _AND + char *dst _AND + const wchar_t **src _AND + size_t nwc _AND + size_t len _AND + mbstate_t *ps) +{ + return _wcsnrtombs_l (_REENT, dst, src, nwc, len, ps, + __get_current_locale ()); +} + #ifndef _REENT_ONLY size_t _DEFUN (wcsnrtombs, (dst, src, nwc, len, ps), @@ -183,6 +192,7 @@ _DEFUN (wcsnrtombs, (dst, src, nwc, len, ps), size_t len _AND mbstate_t *__restrict ps) { - return _wcsnrtombs_r (_REENT, dst, src, nwc, len, ps); + return _wcsnrtombs_l (_REENT, dst, src, nwc, len, ps, + __get_current_locale ()); } #endif /* !_REENT_ONLY */ -- cgit v1.2.3