summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/strtold.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/strtold.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/strtold.c')
-rw-r--r--newlib/libc/stdlib/strtold.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/newlib/libc/stdlib/strtold.c b/newlib/libc/stdlib/strtold.c
index 1128b747a..6bd1c2cbb 100644
--- a/newlib/libc/stdlib/strtold.c
+++ b/newlib/libc/stdlib/strtold.c
@@ -64,11 +64,25 @@ _strtold_r (struct _reent *ptr, const char *__restrict s00,
{
#ifdef _LDBL_EQ_DBL
/* On platforms where long double is as wide as double. */
- return _strtod_r (ptr, s00, se);
+ return _strtod_l (ptr, s00, se, __get_current_locale ());
#else
long double result;
- _strtorx_r (ptr, s00, se, FLT_ROUNDS, &result);
+ _strtorx_l (ptr, s00, se, FLT_ROUNDS, &result, __get_current_locale ());
+ return result;
+#endif
+}
+
+long double
+strtold_l (const char *__restrict s00, char **__restrict se, locale_t loc)
+{
+#ifdef _LDBL_EQ_DBL
+ /* On platforms where long double is as wide as double. */
+ return _strtod_l (_REENT, s00, se, loc);
+#else
+ long double result;
+
+ _strtorx_l (_REENT, s00, se, FLT_ROUNDS, &result, loc);
return result;
#endif
}
@@ -76,7 +90,15 @@ _strtold_r (struct _reent *ptr, const char *__restrict s00,
long double
strtold (const char *__restrict s00, char **__restrict se)
{
- return _strtold_r (_REENT, s00, se);
+#ifdef _LDBL_EQ_DBL
+ /* On platforms where long double is as wide as double. */
+ return _strtod_l (_REENT, s00, se, __get_current_locale ());
+#else
+ long double result;
+
+ _strtorx_l (_REENT, s00, se, FLT_ROUNDS, &result, __get_current_locale ());
+ return result;
+#endif
}
#endif /* _HAVE_LONG_DOUBLE */