aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/wcstod.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/wcstod.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/wcstod.c')
-rw-r--r--newlib/libc/stdlib/wcstod.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c
index 810c5b3..375ffe2 100644
--- a/newlib/libc/stdlib/wcstod.c
+++ b/newlib/libc/stdlib/wcstod.c
@@ -188,6 +188,7 @@ _wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr,
* corresponding position in the wide char string.
*/
if (endptr != NULL) {
+ const char *decimal_point = __get_numeric_locale(loc)->decimal_point;
/* The only valid multibyte char in a float converted by
strtod/wcstod is the radix char. What we do here is,
figure out if the radix char was in the valid leading
@@ -198,10 +199,9 @@ _wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **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;
}