From 2ee6480ef102506c88a04a04a61b51a0ca76cf69 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 11 Feb 2023 23:56:19 +0100 Subject: [PATCH] intl: Simplify function prefixes. * gettext-runtime/intl/configure.ac: Remove macro definitions of _nl_locale_name_canonicalize, _nl_locale_name_from_win32_LANGID, _nl_locale_name_from_win32_LCID, _nl_locale_name_thread_unsafe, _nl_locale_name_posix, _nl_locale_name_default. * gettext-runtime/intl/gettextP.h: Update declarations. * gettext-runtime/intl/langprefs.c: Likewise. (_nl_language_preferences_win32_mui, _nl_language_preferences_win32_ME, _nl_language_preferences_win32_95, _nl_language_preferences_default): Use gl_ prefixed symbols instead. * gettext-runtime/intl/dcigettext.c (DCIGETTEXT, guess_category_value): Likewise. --- gettext-runtime/intl/configure.ac | 6 ------ gettext-runtime/intl/dcigettext.c | 8 ++++---- gettext-runtime/intl/gettextP.h | 10 +++++----- gettext-runtime/intl/langprefs.c | 28 ++++++++++++++-------------- 4 files changed, 23 insertions(+), 29 deletions(-) diff --git a/gettext-runtime/intl/configure.ac b/gettext-runtime/intl/configure.ac index 137eda51b..9ccd1dc32 100644 --- a/gettext-runtime/intl/configure.ac +++ b/gettext-runtime/intl/configure.ac @@ -234,19 +234,13 @@ AH_VERBATIM([0noexport], [ #define rpl_free _libintl_free /* Symbols defined by gnulib module 'localename'. */ #define gl_locale_name_canonicalize _libintl_locale_name_canonicalize -#define _nl_locale_name_canonicalize _libintl_locale_name_canonicalize #define gl_locale_name_from_win32_LANGID _libintl_locale_name_from_win32_LANGID -#define _nl_locale_name_from_win32_LANGID _libintl_locale_name_from_win32_LANGID #define gl_locale_name_from_win32_LCID _libintl_locale_name_from_win32_LCID -#define _nl_locale_name_from_win32_LCID _libintl_locale_name_from_win32_LCID #define gl_locale_name_thread_unsafe _libintl_locale_name_thread_unsafe -#define _nl_locale_name_thread_unsafe _libintl_locale_name_thread_unsafe #define gl_locale_name_thread _libintl_locale_name_thread #define gl_locale_name_posix _libintl_locale_name_posix -#define _nl_locale_name_posix _libintl_locale_name_posix #define gl_locale_name_environ _libintl_locale_name_environ #define gl_locale_name_default _libintl_locale_name_default -#define _nl_locale_name_default _libintl_locale_name_default #define gl_locale_name _libintl_locale_name #define rpl_newlocale _libintl_newlocale #define rpl_duplocale _libintl_duplocale diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index 666a624b0..277bb061f 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -525,7 +525,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, # else categoryname = category_to_name (category); # define CATEGORYNAME_INITIALIZED - localename = _nl_locale_name_thread_unsafe (category, categoryname); + localename = gl_locale_name_thread_unsafe (category, categoryname); if (localename == NULL) localename = ""; # endif @@ -1606,14 +1606,14 @@ guess_category_value (int category, const char *categoryname) # else locale_defaulted = 0; # if HAVE_USELOCALE - locale = _nl_locale_name_thread_unsafe (category, categoryname); + locale = gl_locale_name_thread_unsafe (category, categoryname); if (locale == NULL) # endif { - locale = _nl_locale_name_posix (category, categoryname); + locale = gl_locale_name_posix (category, categoryname); if (locale == NULL) { - locale = _nl_locale_name_default (); + locale = gl_locale_name_default (); locale_defaulted = 1; } } diff --git a/gettext-runtime/intl/gettextP.h b/gettext-runtime/intl/gettextP.h index 536e8bd43..9219b3cfe 100644 --- a/gettext-runtime/intl/gettextP.h +++ b/gettext-runtime/intl/gettextP.h @@ -229,11 +229,11 @@ extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr; #ifndef _LIBC extern const char *_nl_language_preferences_default (void); -extern void _nl_locale_name_canonicalize (char *name); -/* extern const char *_nl_locale_name_from_win32_LANGID (LANGID langid); */ -/* extern const char *_nl_locale_name_from_win32_LCID (LCID lcid); */ -extern const char *_nl_locale_name_thread_unsafe (int category, - const char *categoryname); +extern void gl_locale_name_canonicalize (char *name); +/* extern const char *gl_locale_name_from_win32_LANGID (LANGID langid); */ +/* extern const char *gl_locale_name_from_win32_LCID (LCID lcid); */ +extern const char *gl_locale_name_thread_unsafe (int category, + const char *categoryname); #endif struct loaded_l10nfile *_nl_find_domain (const char *__dirname, diff --git a/gettext-runtime/intl/langprefs.c b/gettext-runtime/intl/langprefs.c index f774ba2ba..937cdf1bd 100644 --- a/gettext-runtime/intl/langprefs.c +++ b/gettext-runtime/intl/langprefs.c @@ -1,5 +1,5 @@ /* Determine the user's language preferences. - Copyright (C) 2004-2007, 2018-2019 Free Software Foundation, Inc. + Copyright (C) 2004-2007, 2018-2023 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -33,7 +33,7 @@ # include # include # include -extern void _nl_locale_name_canonicalize (char *name); +extern void gl_locale_name_canonicalize (char *name); #endif #if defined _WIN32 @@ -51,9 +51,9 @@ extern void _nl_locale_name_canonicalize (char *name); # define STATUS_BUFFER_OVERFLOW 0x80000005 # endif -extern void _nl_locale_name_canonicalize (char *name); -extern const char *_nl_locale_name_from_win32_LANGID (LANGID langid); -extern const char *_nl_locale_name_from_win32_LCID (LCID lcid); +extern void gl_locale_name_canonicalize (char *name); +extern const char *gl_locale_name_from_win32_LANGID (LANGID langid); +extern const char *gl_locale_name_from_win32_LCID (LCID lcid); /* Get the preferences list through the MUI APIs. This works on Windows Vista and newer. */ @@ -127,7 +127,7 @@ _nl_language_preferences_win32_mui (HMODULE kernel32) /* An unexpected Win32 locale name occurred. */ break; *q = '\0'; - _nl_locale_name_canonicalize (q2); + gl_locale_name_canonicalize (q2); q = q2 + strlen (q2); p++; } @@ -159,7 +159,7 @@ _nl_language_preferences_win32_ME (HMODULE kernel32) (GetUserDefaultUILanguage_func) GetProcAddress (kernel32, "GetUserDefaultUILanguage"); if (p_GetUserDefaultUILanguage != NULL) - return _nl_locale_name_from_win32_LANGID (p_GetUserDefaultUILanguage ()); + return gl_locale_name_from_win32_LANGID (p_GetUserDefaultUILanguage ()); return NULL; } @@ -200,7 +200,7 @@ _nl_language_preferences_win32_95 () /* Parse it as a hexadecimal number. */ lcid = strtoul ((char *) data, &endp, 16); if (endp > (char *) data && *endp == '\0') - return _nl_locale_name_from_win32_LCID (lcid); + return gl_locale_name_from_win32_LCID (lcid); } } } @@ -211,7 +211,7 @@ _nl_language_preferences_win32_95 () static BOOL CALLBACK ret_first_language (HMODULE h, LPCSTR type, LPCSTR name, WORD lang, LONG_PTR param) { - *(const char **)param = _nl_locale_name_from_win32_LANGID (lang); + *(const char **)param = gl_locale_name_from_win32_LANGID (lang); return FALSE; } static const char * @@ -274,13 +274,13 @@ _nl_language_preferences_default (void) kCFStringEncodingASCII)) { strcpy (buf2, buf); - _nl_locale_name_canonicalize (buf); + gl_locale_name_canonicalize (buf); size += strlen (buf) + 1; /* Mac OS X 10.12 or newer returns an array of elements of the form "ll-CC" or "ll-Scrp-CC" where ll is a language code, CC is a country code, and Scrp (optional) is a script code. - _nl_locale_name_canonicalize converts this to "ll_CC" or + gl_locale_name_canonicalize converts this to "ll_CC" or "ll_Scrp_CC". Sometimes ll and CC are unrelated, i.e. there is no translation for "ll_CC" but one for "ll". @@ -294,7 +294,7 @@ _nl_language_preferences_default (void) if (last_minus != NULL) { *last_minus = '\0'; - _nl_locale_name_canonicalize (buf2); + gl_locale_name_canonicalize (buf2); size += strlen (buf2) + 1; } } @@ -329,7 +329,7 @@ _nl_language_preferences_default (void) kCFStringEncodingASCII)) { strcpy (buf2, buf); - _nl_locale_name_canonicalize (buf); + gl_locale_name_canonicalize (buf); strcpy (p, buf); p += strlen (buf); *p++ = ':'; @@ -338,7 +338,7 @@ _nl_language_preferences_default (void) if (last_minus != NULL) { *last_minus = '\0'; - _nl_locale_name_canonicalize (buf2); + gl_locale_name_canonicalize (buf2); strcpy (p, buf2); p += strlen (buf2); *p++ = ':'; -- 2.47.3