summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/wcsnrtombs.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-08-10 16:30:46 +0200
committerCorinna Vinschen <corinna@vinschen.de>2016-08-15 17:35:21 +0200
commit238455adfab4f8070ac65400aac22bb8a9e502fc (patch)
tree68dbe978bc7250338ba2de4bab0db5f2feb81b32 /newlib/libc/stdlib/wcsnrtombs.c
parent5ef60b7e6a0abad86fe637197f738f8a90b525c8 (diff)
downloadcygnal-238455adfab4f8070ac65400aac22bb8a9e502fc.tar.gz
cygnal-238455adfab4f8070ac65400aac22bb8a9e502fc.tar.bz2
cygnal-238455adfab4f8070ac65400aac22bb8a9e502fc.zip
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 <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdlib/wcsnrtombs.c')
-rw-r--r--newlib/libc/stdlib/wcsnrtombs.c28
1 files changed, 19 insertions, 9 deletions
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 <stdio.h>
#include <errno.h>
#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 */