aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/wcstold.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2018-09-05 21:25:01 -0700
committerCorinna Vinschen <corinna@vinschen.de>2018-09-06 14:14:05 +0200
commit3b6994ec5f5fb47ba87fb3dae154cad21017b30d (patch)
treead556af6dc4258f8506694e2165e74514c6f9616 /newlib/libc/stdlib/wcstold.c
parent28ecec475ff423b368bcca329f42cfed29308d61 (diff)
downloadnewlib-3b6994ec5f5fb47ba87fb3dae154cad21017b30d.zip
newlib-3b6994ec5f5fb47ba87fb3dae154cad21017b30d.tar.gz
newlib-3b6994ec5f5fb47ba87fb3dae154cad21017b30d.tar.bz2
stdlib: Use __get_numeric_locale instead of __localeconv_l for decimal_point
The string/float conversion functions need to get the locale decimal point. Instead of calling __localeconv_l (which copies locale data into lconv form from __get_numeric_locale), use __get_numeric_locale directly. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'newlib/libc/stdlib/wcstold.c')
-rw-r--r--newlib/libc/stdlib/wcstold.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/newlib/libc/stdlib/wcstold.c b/newlib/libc/stdlib/wcstold.c
index 4876e11..673d928 100644
--- a/newlib/libc/stdlib/wcstold.c
+++ b/newlib/libc/stdlib/wcstold.c
@@ -83,6 +83,7 @@ wcstold_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
if (endptr != NULL)
{
+ const char *decimal_point = __get_numeric_locale(loc)->decimal_point;
/* The only valid multibyte char in a float converted by
strtold/wcstold is the radix char. What we do here is,
figure out if the radix char was in the valid leading
@@ -93,10 +94,10 @@ wcstold_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
just one byte long. The resulting difference (end - buf)
is then equivalent to the number of valid wide characters
in the input string. */
- len = strlen (__localeconv_l (loc)->decimal_point);
+ len = strlen (decimal_point);
if (len > 1)
{
- char *d = strstr (buf, __localeconv_l (loc)->decimal_point);
+ char *d = strstr (buf, decimal_point);
if (d && d < end)
end -= len - 1;