diff --git a/src/fallback.cpp b/src/fallback.cpp index 654eafc09..3f2912551 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -394,18 +394,9 @@ int flock(int fd, int op) { // For platforms without wcstod_l C extension, wrap wcstod after changing the // thread-specific locale. double fish_compat::wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc) { - // Create and use a new, thread-specific locale - // NOTE: We use "C" whatever the passed locale, - // and we use the LC_ALL category. - // - // Empirically, this fails on OpenIndiana/Illumos/Solaris/SunOS if using LC_NUMERIC. - // Since we reset it afterwards, it shouldn't matter. - locale_t locale = newlocale(LC_ALL, "C", nullptr); - locale_t prev_locale = uselocale(locale); + locale_t prev_locale = uselocale(loc); double ret = wcstod(enptr, endptr); - // Restore the old locale before freeing the locale we created and are still using uselocale(prev_locale); - freelocale(locale); return ret; } #endif // defined(wcstod_l)