summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/strtold.c
diff options
context:
space:
mode:
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 */