From 6e463f6c031d0f0dfbfb6e48496d2ef585247071 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 22 Feb 2025 18:18:53 +0100 Subject: [PATCH] localename-unsafe: Use getlocalename_l-unsafe. * lib/localename-unsafe.c: Include getlocalename_l-unsafe.h. (gl_locale_name_thread_unsafe): Invoke getlocalename_l_unsafe instead of getlocalename_l. * modules/localename-unsafe (Depends-on): Add getlocalename_l-unsafe. Remove getlocalename_l-simple. * modules/localename-unsafe-limited (Depends-on): Likewise. --- ChangeLog | 10 ++++++++++ lib/localename-unsafe.c | 7 ++++++- modules/localename-unsafe | 2 +- modules/localename-unsafe-limited | 2 +- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd437a98b7..3f9a7bb618 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2025-02-22 Bruno Haible + + localename-unsafe: Use getlocalename_l-unsafe. + * lib/localename-unsafe.c: Include getlocalename_l-unsafe.h. + (gl_locale_name_thread_unsafe): Invoke getlocalename_l_unsafe instead of + getlocalename_l. + * modules/localename-unsafe (Depends-on): Add getlocalename_l-unsafe. + Remove getlocalename_l-simple. + * modules/localename-unsafe-limited (Depends-on): Likewise. + 2025-02-22 Bruno Haible getlocalename_l-unsafe: New module. diff --git a/lib/localename-unsafe.c b/lib/localename-unsafe.c index 569bf9ba99..a058281f5b 100644 --- a/lib/localename-unsafe.c +++ b/lib/localename-unsafe.c @@ -34,6 +34,7 @@ #include #include +#include "getlocalename_l-unsafe.h" #include "setlocale_null.h" #if HAVE_GOOD_USELOCALE @@ -2622,7 +2623,11 @@ gl_locale_name_thread_unsafe (int category, _GL_UNUSED const char *categoryname) { locale_t thread_locale = uselocale (NULL); if (thread_locale != LC_GLOBAL_LOCALE) - return getlocalename_l (category, thread_locale); + { + struct string_with_storage ret = + getlocalename_l_unsafe (category, thread_locale); + return ret.value; + } } #endif /* On WINDOWS_NATIVE, don't use GetThreadLocale() here, because when diff --git a/modules/localename-unsafe b/modules/localename-unsafe index b7d073deea..01ab5a42d0 100644 --- a/modules/localename-unsafe +++ b/modules/localename-unsafe @@ -18,7 +18,7 @@ extensions locale-h strdup lock -getlocalename_l-simple +getlocalename_l-unsafe setlocale-null-unlocked configure.ac: diff --git a/modules/localename-unsafe-limited b/modules/localename-unsafe-limited index 51e8b1e882..9ca367e48c 100644 --- a/modules/localename-unsafe-limited +++ b/modules/localename-unsafe-limited @@ -13,7 +13,7 @@ m4/lcmessage.m4 Depends-on: extensions locale-h -getlocalename_l-simple +getlocalename_l-unsafe setlocale-null-unlocked configure.ac: -- 2.39.5