From f7efd84ea3e6ff2be5932b5213ac60c5c022f5b9 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 18 Dec 2019 15:07:05 +0100 Subject: [PATCH] localename: Optimize code for native Windows. * lib/localename.c (gl_locale_name_posix): Remove handling of LC_ALL category (not allowed here). --- ChangeLog | 8 +++++++- lib/localename.c | 10 +--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d8b1c04e8..042b4c6354 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 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. * lib/setlocale.c: Include . (setlocale_mtsafe): New function. @@ -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); -- 2.11.4.GIT