[newlib-cygwin/main] Cygwin: /proc/locales: filter out useless explicit utf8 locales

Corinna Vinschen corinna@sourceware.org
Sun Mar 26 12:18:21 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=80cea279426fbb03f4954bb8be88fb1a2b5e320b

commit 80cea279426fbb03f4954bb8be88fb1a2b5e320b
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Sun Mar 26 14:12:13 2023 +0200
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Sun Mar 26 14:12:13 2023 +0200

    Cygwin: /proc/locales: filter out useless explicit utf8 locales
    
    Fixes: c42b98bdc665f ("Cygwin: introduce /proc/codesets and /proc/locales")
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler/proc.cc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index 961e894736c3..0e60c519ef79 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -2240,8 +2240,9 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD info, LPARAM param)
   __set_charset_from_locale (posix_loc_and_modifier, codeset);
   *bufptr_p = add_locale (*bufptr_p, posix_loc, codeset, false, modifier,
 			  win_locale);
-  *bufptr_p = add_locale (*bufptr_p, posix_loc, "UTF-8", true, modifier,
-			  win_locale);
+  if (strcmp (codeset, "UTF-8") != 0)
+    *bufptr_p = add_locale (*bufptr_p, posix_loc, "UTF-8", true, modifier,
+			    win_locale);
 
   /* Only one cross each */
   if (modifier[0])
@@ -2274,8 +2275,9 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD info, LPARAM param)
   __set_charset_from_locale (posix_loc_and_modifier, codeset);
   *bufptr_p = add_locale (*bufptr_p, posix_loc, codeset, false, modifier,
 			  win_locale);
-  *bufptr_p = add_locale (*bufptr_p, posix_loc, "UTF-8", true, modifier,
-			  win_locale);
+  if (strcmp (codeset, "UTF-8") != 0 && strcmp (modifier, "@euro") != 0)
+    *bufptr_p = add_locale (*bufptr_p, posix_loc, "UTF-8", true, modifier,
+			    win_locale);
 
   return TRUE;
 }


More information about the Cygwin-cvs mailing list