From: Bruno Haible Date: Wed, 18 Dec 2019 14:07:05 +0000 (+0100) Subject: localename: Optimize code for native Windows. X-Git-Tag: v1.0~4479 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f7efd84ea3e6ff2be5932b5213ac60c5c022f5b9;p=thirdparty%2Fgnulib.git localename: Optimize code for native Windows. * lib/localename.c (gl_locale_name_posix): Remove handling of LC_ALL category (not allowed here). --- diff --git a/ChangeLog b/ChangeLog index 7d8b1c04e8..042b4c6354 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-12-18 Bruno Haible + + localename: Optimize code for native Windows. + * lib/localename.c (gl_locale_name_posix): Remove handling of LC_ALL + category (not allowed here). + 2019-12-18 Bruno Haible setlocale: Make calls with NULL argument multithread-safe. @@ -133,7 +139,7 @@ 2019-12-17 Bruno Haible localcharset: Optimize code for native Windows. - * lib/localcharset.c (locale_charset): Don't both calling + * lib/localcharset.c (locale_charset): Don't bother calling setlocale (LC_ALL, NULL) since we're not interested in its result. 2019-12-17 Bruno Haible diff --git a/lib/localename.c b/lib/localename.c index b6b94c274b..d88743e4ce 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -3242,19 +3242,11 @@ gl_locale_name_posix (int category, const char *categoryname) if (LC_MIN <= category && category <= LC_MAX) { const char *locname = setlocale (category, NULL); - LCID lcid; - - /* If CATEGORY is LC_ALL, the result might be a semi-colon - separated list of locales. We need only one, so we take the - one corresponding to LC_CTYPE, as the most important for - character translations. */ - if (category == LC_ALL && strchr (locname, ';')) - locname = setlocale (LC_CTYPE, NULL); /* Convert locale name to LCID. We don't want to use LocaleNameToLCID because (a) it is only available since Vista, and (b) it doesn't accept locale names returned by 'setlocale'. */ - lcid = get_lcid (locname); + LCID lcid = get_lcid (locname); if (lcid > 0) return gl_locale_name_from_win32_LCID (lcid);