musl-locale.patch (966B)
1 diff --git a/locale.c b/locale.c 2 index 7653340..7243cb1 100644 3 --- a/locale.c 4 +++ b/locale.c 5 @@ -581,6 +581,10 @@ S_emulate_setlocale(const int category, 6 7 return (char *) querylocale(mask, cur_obj); 8 9 +# elif defined(_NL_LOCALE_NAME) 10 + 11 + return (char *) nl_langinfo_l(_NL_LOCALE_NAME(category), cur_obj); 12 + 13 # else 14 15 /* If this assert fails, adjust the size of curlocales in intrpvar.h */ 16 @@ -737,7 +741,7 @@ S_emulate_setlocale(const int category, 17 18 /* Here, we are switching locales. */ 19 20 -# ifndef HAS_QUERYLOCALE 21 +# if !defined(HAS_QUERYLOCALE) && !defined(_NL_LOCALE_NAME) 22 23 if (strEQ(locale, "")) { 24 25 @@ -1094,6 +1098,12 @@ S_emulate_setlocale(const int category, 26 locale = querylocale(mask, new_obj); 27 } 28 29 +# elif defined(_NL_LOCALE_NAME) 30 + 31 + if (strEQ(locale, "")) { 32 + locale = nl_langinfo_l(_NL_LOCALE_NAME(category), new_obj); 33 + } 34 + 35 # else 36 37 /* Here, 'locale' is the return value */