>From faee74eb1fd31eed2fb5b6eefea4ce58c65301c7 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Fri, 2 Oct 2026 21:53:08 -0400 Subject: [PATCH 05/10] strtod_l family: honor the locale_t argument now that the strtod family supports a locale-specific radix character, these wrappers need to call uselocale. it would be possible to do this the other way around and have the core function take a locale_t argument, but that would be a much bigger change and probably not well-motivated as long as the _l versions are a nonstandard extension. --- src/locale/strtod_l.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/locale/strtod_l.c b/src/locale/strtod_l.c index 574ba148..58afab51 100644 --- a/src/locale/strtod_l.c +++ b/src/locale/strtod_l.c @@ -4,17 +4,26 @@ float strtof_l(const char *restrict s, char **restrict p, locale_t l) { - return strtof(s, p); + locale_t old = uselocale(l); + float r = strtof(s, p); + uselocale(old); + return r; } double strtod_l(const char *restrict s, char **restrict p, locale_t l) { - return strtod(s, p); + locale_t old = uselocale(l); + double r = strtod(s, p); + uselocale(old); + return r; } long double strtold_l(const char *restrict s, char **restrict p, locale_t l) { - return strtold(s, p); + locale_t old = uselocale(l); + long double r = strtold(s, p); + uselocale(old); + return r; } weak_alias(strtof_l, __strtof_l); -- 2.21.0