From: Bruno Haible Date: Mon, 12 Aug 2024 11:09:56 +0000 (+0200) Subject: libintl: Remove conditionals for libglocale. X-Git-Tag: v0.23~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6a6801c163e8a2fcb2a0bbdd65f39cca98d7c0d;p=thirdparty%2Fgettext.git libintl: Remove conditionals for libglocale. libglocale was a short-lived project in 2005 that was never completed. * gettext-runtime/intl/dcigettext.c: Assume IN_LIBGLOCALE is not defined. * gettext-runtime/intl/libgnuintl.in.h: Likewise. * gettext-runtime/intl/loadmsgcat.c: Likewise. * gettext-runtime/intl/localealias.c: Likewise. * gettext-runtime/intl/plural-exp.h: Likewise. * gettext-runtime/intl/gettextP.h: Likewise. (gl_dcigettext): Remove declaration. * gettext-runtime/intl/Makefile.am (libgnuintl.h, libintl.h): Remove the IN_LIBGLOCALE handling. --- diff --git a/gettext-runtime/intl/Makefile.am b/gettext-runtime/intl/Makefile.am index 561d51f73..3b0deef6d 100644 --- a/gettext-runtime/intl/Makefile.am +++ b/gettext-runtime/intl/Makefile.am @@ -222,8 +222,7 @@ endif EXTRA_DIST += export.h libgnuintl.h: $(srcdir)/libgnuintl.in.h $(srcdir)/export.h - sed -e '/IN_LIBGLOCALE/d' \ - -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ + sed -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \ -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \ -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \ @@ -244,8 +243,7 @@ libgnuintl.h: $(srcdir)/libgnuintl.in.h $(srcdir)/export.h MOSTLYCLEANFILES += libgnuintl.h libintl.h: $(srcdir)/libgnuintl.in.h - sed -e '/IN_LIBGLOCALE/d' \ - -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ + sed -e 's,@''HAVE_POSIX_PRINTF''@,@HAVE_POSIX_PRINTF@,g' \ -e 's,@''HAVE_ASPRINTF''@,@HAVE_ASPRINTF@,g' \ -e 's,@''HAVE_SNPRINTF''@,@HAVE_SNPRINTF@,g' \ -e 's,@''HAVE_WPRINTF''@,@HAVE_WPRINTF@,g' \ diff --git a/gettext-runtime/intl/dcigettext.c b/gettext-runtime/intl/dcigettext.c index 4337f3af7..3a6329473 100644 --- a/gettext-runtime/intl/dcigettext.c +++ b/gettext-runtime/intl/dcigettext.c @@ -83,9 +83,6 @@ extern int errno; #ifdef _LIBC # include #else -# ifdef IN_LIBGLOCALE -# include -# endif # include "libgnuintl.h" #endif #include "hash-string.h" @@ -183,7 +180,7 @@ static void *mempcpy (void *dest, const void *src, size_t n); #endif /* Whether to support different locales in different threads. */ -#if defined _LIBC || HAVE_USELOCALE || defined IN_LIBGLOCALE +#if defined _LIBC || HAVE_USELOCALE # define HAVE_PER_THREAD_LOCALE #endif @@ -202,11 +199,6 @@ struct known_translation_t const char *localename; #endif -#ifdef IN_LIBGLOCALE - /* The character encoding. */ - const char *encoding; -#endif - /* State of the catalog counter at the point the string was found. */ int counter; @@ -253,16 +245,10 @@ transcmp (const void *p1, const void *p2) result = strcmp (s1->localename, s2->localename); if (result == 0) #endif - { -#ifdef IN_LIBGLOCALE - result = strcmp (s1->encoding, s2->encoding); - if (result == 0) -#endif - /* We compare the category last (though this is the cheapest - operation) since it is hopefully always the same (namely - LC_MESSAGES). */ - result = s1->category - s2->category; - } + /* We compare the category last (though this is the cheapest + operation) since it is hopefully always the same (namely + LC_MESSAGES). */ + result = s1->category - s2->category; } } @@ -273,11 +259,9 @@ transcmp (const void *p1, const void *p2) textdomain(3). The default value for this is "messages". */ const char _nl_default_default_domain[] attribute_hidden = "messages"; -#ifndef IN_LIBGLOCALE /* Value used as the default domain for gettext(3). */ const char *_nl_current_default_domain attribute_hidden = _nl_default_default_domain; -#endif /* Contains the default location of the message catalogs. */ #if defined __EMX__ && !defined __KLIBC__ @@ -293,25 +277,17 @@ libc_hidden_data_def (_nl_default_dirname) # endif #endif -#ifndef IN_LIBGLOCALE /* List with bindings of specific domains created by bindtextdomain() calls. */ struct binding *_nl_domain_bindings; -#endif /* Prototypes for local functions. */ static char *plural_lookup (struct loaded_l10nfile *domain, unsigned long int n, const char *translation, size_t translation_len); -#ifdef IN_LIBGLOCALE -static const char *guess_category_value (int category, - const char *categoryname, - const char *localename); -#else static const char *guess_category_value (int category, const char *categoryname); -#endif #ifdef _LIBC # include "../locale/localeinfo.h" @@ -319,7 +295,7 @@ static const char *guess_category_value (int category, #else static const char *category_to_name (int category); #endif -#if (defined _LIBC || HAVE_ICONV) && !defined IN_LIBGLOCALE +#if defined _LIBC || HAVE_ICONV static const char *get_output_charset (struct binding *domainbinding); #endif @@ -425,18 +401,9 @@ static int enable_secure; /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale and, if PLURAL is nonzero, search over string depending on the plural form determined by N. */ -#ifdef IN_LIBGLOCALE -char * -gl_dcigettext (const char *domainname, - const char *msgid1, const char *msgid2, - int plural, unsigned long int n, - int category, - const char *localename, const char *encoding) -#else char * DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, int plural, unsigned long int n, int category) -#endif { #ifndef HAVE_ALLOCA struct block_list *block_list = NULL; @@ -457,7 +424,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, int saved_errno; struct known_translation_t search; struct known_translation_t **foundp = NULL; -#if defined HAVE_PER_THREAD_LOCALE && !defined IN_LIBGLOCALE +#if defined HAVE_PER_THREAD_LOCALE const char *localename; #endif size_t domainname_len; @@ -504,22 +471,17 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, search.domainname = domainname; search.category = category; #ifdef HAVE_PER_THREAD_LOCALE -# ifndef IN_LIBGLOCALE -# ifdef _LIBC +# ifdef _LIBC localename = __current_locale_name (category); -# else +# else categoryname = category_to_name (category); -# define CATEGORYNAME_INITIALIZED +# define CATEGORYNAME_INITIALIZED localename = gl_locale_name_thread_unsafe (category, categoryname); if (localename == NULL) localename = ""; -# endif # endif search.localename = localename; #endif -#ifdef IN_LIBGLOCALE - search.encoding = encoding; -#endif /* Since tfind/tsearch manage a balanced tree, concurrent tfind and tsearch calls can be fatal. */ @@ -550,15 +512,6 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, DETERMINE_SECURE; /* First find matching binding. */ -#ifdef IN_LIBGLOCALE - /* We can use a trivial binding, since _nl_find_msg will ignore it anyway, - and _nl_load_domain and _nl_find_domain just pass it through. */ - binding = NULL; - dirname = bindtextdomain (domainname, NULL); -# if defined _WIN32 && !defined __CYGWIN__ - wdirname = wbindtextdomain (domainname, NULL); -# endif -#else for (binding = _nl_domain_bindings; binding != NULL; binding = binding->next) { int compare = strcmp (domainname, binding->domainname); @@ -576,18 +529,15 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, if (binding == NULL) { dirname = _nl_default_dirname; -# if defined _WIN32 && !defined __CYGWIN__ +#if defined _WIN32 && !defined __CYGWIN__ wdirname = NULL; -# endif +#endif } else { dirname = binding->dirname; -# if defined _WIN32 && !defined __CYGWIN__ - wdirname = binding->wdirname; -# endif -#endif #if defined _WIN32 && !defined __CYGWIN__ + wdirname = binding->wdirname; if (wdirname != NULL ? IS_RELATIVE_FILE_NAME (wdirname) : IS_RELATIVE_FILE_NAME (dirname)) @@ -675,19 +625,13 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, dirname = xdirname; } #endif -#ifndef IN_LIBGLOCALE } -#endif /* Now determine the symbolic name of CATEGORY and its value. */ #ifndef CATEGORYNAME_INITIALIZED categoryname = category_to_name (category); #endif -#ifdef IN_LIBGLOCALE - categoryvalue = guess_category_value (category, categoryname, localename); -#else categoryvalue = guess_category_value (category, categoryname); -#endif domainname_len = strlen (domainname); xdomainname = (char *) alloca (strlen (categoryname) @@ -750,11 +694,7 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, if (domain != NULL) { -#if defined IN_LIBGLOCALE - retval = _nl_find_msg (domain, binding, encoding, msgid1, &retlen); -#else retval = _nl_find_msg (domain, binding, msgid1, 1, &retlen); -#endif if (retval == NULL) { @@ -762,13 +702,8 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) { -#if defined IN_LIBGLOCALE - retval = _nl_find_msg (domain->successor[cnt], binding, - encoding, msgid1, &retlen); -#else retval = _nl_find_msg (domain->successor[cnt], binding, msgid1, 1, &retlen); -#endif /* Resource problems are not fatal, instead we return no translation. */ @@ -828,9 +763,6 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, newp->category = category; #ifdef HAVE_PER_THREAD_LOCALE newp->localename = new_localename; -#endif -#ifdef IN_LIBGLOCALE - newp->encoding = encoding; #endif newp->counter = _nl_msg_cat_cntr; newp->domain = domain; @@ -911,19 +843,12 @@ __libc_lock_define_initialized (static, lock) Return it if found. Return NULL if not found or in case of a conversion failure (problem in the particular message catalog). Return (char *) -1 in case of a memory allocation failure during conversion (only if - ENCODING != NULL resp. CONVERT == true). */ + CONVERT == true). */ char * -#ifdef IN_LIBGLOCALE -_nl_find_msg (struct loaded_l10nfile *domain_file, - struct binding *domainbinding, const char *encoding, - const char *msgid, - size_t *lengthp) -#else _nl_find_msg (struct loaded_l10nfile *domain_file, struct binding *domainbinding, const char *msgid, int convert, size_t *lengthp) -#endif { struct loaded_domain *domain; nls_uint32 nstrings; @@ -1029,16 +954,10 @@ _nl_find_msg (struct loaded_l10nfile *domain_file, } #if defined _LIBC || HAVE_ICONV -# ifdef IN_LIBGLOCALE - if (encoding != NULL) -# else if (convert) -# endif { /* We are supposed to do a conversion. */ -# ifndef IN_LIBGLOCALE const char *encoding = get_output_charset (domainbinding); -# endif size_t nconversions; struct converted_domain *convd; size_t i; @@ -1132,20 +1051,13 @@ _nl_find_msg (struct loaded_l10nfile *domain_file, reallocate domain->conversions because we pass encoding = NULL or convert = 0, respectively. */ nullentry = -# ifdef IN_LIBGLOCALE - _nl_find_msg (domain_file, domainbinding, NULL, "", - &nullentrylen); -# else _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen); -# endif /* Resource problems are fatal. If we continue onwards we will only attempt to calloc a new conv_tab and fail later. */ if (__builtin_expect (nullentry == (char *) -1, 0)) { -# ifndef IN_LIBGLOCALE free ((char *) encoding); -# endif goto unlock_fail; } @@ -1550,21 +1462,13 @@ category_to_name (int category) This uses values of the environment variables LC_ALL, LC_*, LANG, LANGUAGE, and/or system-dependent defaults. */ static const char * -#ifdef IN_LIBGLOCALE -guess_category_value (int category, const char *categoryname, - const char *locale) - -#else guess_category_value (int category, const char *categoryname) -#endif { const char *language; -#ifndef IN_LIBGLOCALE const char *locale; -# ifndef _LIBC +#ifndef _LIBC const char *language_default; int locale_defaulted; -# endif #endif /* We use the settings in the following order: @@ -1581,18 +1485,17 @@ guess_category_value (int category, const char *categoryname) - If the system provides both a list of languages and a default locale, the former is used. */ -#ifndef IN_LIBGLOCALE /* Fetch the locale name, through the POSIX method of looking to `LC_ALL', `LC_xxx', and `LANG'. On some systems this can be done by the `setlocale' function itself. */ -# ifdef _LIBC +#ifdef _LIBC locale = __current_locale_name (category); -# else +#else locale_defaulted = 0; -# if HAVE_USELOCALE +# if HAVE_USELOCALE locale = gl_locale_name_thread_unsafe (category, categoryname); if (locale == NULL) -# endif +# endif { locale = gl_locale_name_posix (category, categoryname); if (locale == NULL) @@ -1601,7 +1504,6 @@ guess_category_value (int category, const char *categoryname) locale_defaulted = 1; } } -# endif #endif /* Ignore LANGUAGE and its system-dependent analogon if the locale is set @@ -1627,7 +1529,7 @@ guess_category_value (int category, const char *categoryname) language = getenv ("LANGUAGE"); if (language != NULL && language[0] != '\0') return language; -#if !defined IN_LIBGLOCALE && !defined _LIBC +#if !defined _LIBC /* The next priority value is the locale name, if not defaulted. */ if (locale_defaulted) { @@ -1641,7 +1543,7 @@ guess_category_value (int category, const char *categoryname) return locale; } -#if (defined _LIBC || HAVE_ICONV) && !defined IN_LIBGLOCALE +#if defined _LIBC || HAVE_ICONV /* Returns the output charset. */ static const char * get_output_charset (struct binding *domainbinding) diff --git a/gettext-runtime/intl/gettextP.h b/gettext-runtime/intl/gettextP.h index 7658da6e7..8059a7641 100644 --- a/gettext-runtime/intl/gettextP.h +++ b/gettext-runtime/intl/gettextP.h @@ -1,5 +1,5 @@ /* Header describing internals of libintl library. - Copyright (C) 1995-2023 Free Software Foundation, Inc. + Copyright (C) 1995-2024 Free Software Foundation, Inc. Written by Ulrich Drepper , 1995. This program is free software: you can redistribute it and/or modify @@ -70,18 +70,10 @@ extern void _nl_unload_domain (struct loaded_domain *__domain) # undef _INTL_REDIRECT_MACROS # define _INTL_REDIRECT_MACROS # include "libgnuintl.h" -# ifdef IN_LIBGLOCALE -extern char *gl_dcigettext (const char *__domainname, - const char *__msgid1, const char *__msgid2, - int __plural, unsigned long int __n, - int __category, - const char *__localename, const char *__encoding); -# else extern char *libintl_dcigettext (const char *__domainname, const char *__msgid1, const char *__msgid2, int __plural, unsigned long int __n, int __category); -# endif #endif #include "loadinfo.h" @@ -217,12 +209,7 @@ struct binding #if defined __KLIBC__ && !defined _LIBC # define _nl_msg_cat_cntr libintl_nl_msg_cat_cntr #endif -#ifdef IN_LIBGLOCALE -# include -extern LIBGLOCALE_SHLIB_EXPORTED int _nl_msg_cat_cntr; -#else extern LIBINTL_SHLIB_EXPORTED int _nl_msg_cat_cntr; -#endif #ifndef _LIBC extern const char *_nl_language_preferences_default (void); @@ -245,18 +232,10 @@ void _nl_load_domain (struct loaded_l10nfile *__domain, struct binding *__domainbinding) attribute_hidden; -#ifdef IN_LIBGLOCALE -char *_nl_find_msg (struct loaded_l10nfile *domain_file, - struct binding *domainbinding, const char *encoding, - const char *msgid, - size_t *lengthp) - attribute_hidden; -#else char *_nl_find_msg (struct loaded_l10nfile *domain_file, struct binding *domainbinding, const char *msgid, int convert, size_t *lengthp) attribute_hidden; -#endif /* The internal variables in the standalone libintl.a must have different names than the internal variables in GNU libc, otherwise programs diff --git a/gettext-runtime/intl/libgnuintl.in.h b/gettext-runtime/intl/libgnuintl.in.h index 4ff2d040c..05a81107a 100644 --- a/gettext-runtime/intl/libgnuintl.in.h +++ b/gettext-runtime/intl/libgnuintl.in.h @@ -1,5 +1,5 @@ /* Message catalogs for internationalization. - Copyright (C) 1995-1997, 2000-2016, 2018-2023 Free Software Foundation, Inc. + Copyright (C) 1995-2024 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 @@ -300,28 +300,26 @@ extern char *dcngettext (const char *__domainname, #endif -#ifndef IN_LIBGLOCALE - /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ -# ifdef _INTL_REDIRECT_INLINE +#ifdef _INTL_REDIRECT_INLINE extern char *libintl_textdomain (const char *__domainname); static inline char *textdomain (const char *__domainname) { return libintl_textdomain (__domainname); } -# else -# ifdef _INTL_REDIRECT_MACROS -# define textdomain libintl_textdomain -# endif +#else +# ifdef _INTL_REDIRECT_MACROS +# define textdomain libintl_textdomain +# endif extern char *textdomain (const char *__domainname) _INTL_ASM (libintl_textdomain); -# endif +#endif /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ -# ifdef _INTL_REDIRECT_INLINE +#ifdef _INTL_REDIRECT_INLINE extern char *libintl_bindtextdomain (const char *__domainname, const char *__dirname); static inline char *bindtextdomain (const char *__domainname, @@ -329,18 +327,18 @@ static inline char *bindtextdomain (const char *__domainname, { return libintl_bindtextdomain (__domainname, __dirname); } -# else -# ifdef _INTL_REDIRECT_MACROS -# define bindtextdomain libintl_bindtextdomain -# endif +#else +# ifdef _INTL_REDIRECT_MACROS +# define bindtextdomain libintl_bindtextdomain +# endif extern char *bindtextdomain (const char *__domainname, const char *__dirname) _INTL_ASM (libintl_bindtextdomain); -# endif +#endif -# if defined _WIN32 && !defined __CYGWIN__ +#if defined _WIN32 && !defined __CYGWIN__ /* Specify that the DOMAINNAME message catalog will be found in WDIRNAME rather than in the system locale data base. */ -# ifdef _INTL_REDIRECT_INLINE +# ifdef _INTL_REDIRECT_INLINE extern wchar_t *libintl_wbindtextdomain (const char *__domainname, const wchar_t *__wdirname); static inline wchar_t *wbindtextdomain (const char *__domainname, @@ -348,19 +346,19 @@ static inline wchar_t *wbindtextdomain (const char *__domainname, { return libintl_wbindtextdomain (__domainname, __wdirname); } -# else -# ifdef _INTL_REDIRECT_MACROS -# define wbindtextdomain libintl_wbindtextdomain -# endif +# else +# ifdef _INTL_REDIRECT_MACROS +# define wbindtextdomain libintl_wbindtextdomain +# endif extern wchar_t *wbindtextdomain (const char *__domainname, const wchar_t *__wdirname) _INTL_ASM (libintl_wbindtextdomain); -# endif # endif +#endif /* Specify the character encoding in which the messages from the DOMAINNAME message catalog will be returned. */ -# ifdef _INTL_REDIRECT_INLINE +#ifdef _INTL_REDIRECT_INLINE extern char *libintl_bind_textdomain_codeset (const char *__domainname, const char *__codeset); static inline char *bind_textdomain_codeset (const char *__domainname, @@ -368,16 +366,14 @@ static inline char *bind_textdomain_codeset (const char *__domainname, { return libintl_bind_textdomain_codeset (__domainname, __codeset); } -# else -# ifdef _INTL_REDIRECT_MACROS -# define bind_textdomain_codeset libintl_bind_textdomain_codeset -# endif +#else +# ifdef _INTL_REDIRECT_MACROS +# define bind_textdomain_codeset libintl_bind_textdomain_codeset +# endif extern char *bind_textdomain_codeset (const char *__domainname, const char *__codeset) _INTL_ASM (libintl_bind_textdomain_codeset); -# endif - -#endif /* IN_LIBGLOCALE */ +#endif /* Support for format strings with positions in *printf(), following the diff --git a/gettext-runtime/intl/loadmsgcat.c b/gettext-runtime/intl/loadmsgcat.c index 6b23498cd..56fb38c04 100644 --- a/gettext-runtime/intl/loadmsgcat.c +++ b/gettext-runtime/intl/loadmsgcat.c @@ -1,5 +1,5 @@ /* Load needed message catalogs. - Copyright (C) 1995-2023 Free Software Foundation, Inc. + Copyright (C) 1995-2024 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 @@ -1225,12 +1225,7 @@ _nl_load_domain (struct loaded_l10nfile *domain_file, #endif /* Get the header entry and look for a plural specification. */ -#ifdef IN_LIBGLOCALE - nullentry = - _nl_find_msg (domain_file, domainbinding, NULL, "", &nullentrylen); -#else nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen); -#endif if (__builtin_expect (nullentry == (char *) -1, 0)) { #ifdef _LIBC diff --git a/gettext-runtime/intl/localealias.c b/gettext-runtime/intl/localealias.c index 427e501d6..f8ac68d2b 100644 --- a/gettext-runtime/intl/localealias.c +++ b/gettext-runtime/intl/localealias.c @@ -1,5 +1,5 @@ /* Handle aliases for locale names. - Copyright (C) 1995-2023 Free Software Foundation, Inc. + Copyright (C) 1995-2024 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 @@ -339,26 +339,19 @@ read_alias_file (const char *fname, int fname_len) else if (cp[0] != '\0') *cp++ = '\0'; -# ifdef IN_LIBGLOCALE - /* glibc's locale.alias contains entries for ja_JP and ko_KR - that make it impossible to use a Japanese or Korean UTF-8 - locale under the name "ja_JP" or "ko_KR". Ignore these - entries. */ - if (strchr (alias, '_') == NULL) -# endif - { - size_t alias_len; - size_t value_len; + { + size_t alias_len; + size_t value_len; - if (nmap >= maxmap) - if (__builtin_expect (extend_alias_table (), 0)) - goto out; + if (nmap >= maxmap) + if (__builtin_expect (extend_alias_table (), 0)) + goto out; - alias_len = strlen (alias) + 1; - value_len = strlen (value) + 1; + alias_len = strlen (alias) + 1; + value_len = strlen (value) + 1; - if (string_space_act + alias_len + value_len > string_space_max) - { + if (string_space_act + alias_len + value_len > string_space_max) + { # if defined __GNUC__ && __GNUC__ >= 12 # pragma GCC diagnostic push /* Suppress the valid GCC 12 warning until the code below is changed @@ -366,46 +359,46 @@ read_alias_file (const char *fname, int fname_len) # pragma GCC diagnostic ignored "-Wuse-after-free" # endif - /* Increase size of memory pool. */ - size_t new_size = (string_space_max - + (alias_len + value_len > 1024 - ? alias_len + value_len : 1024)); - char *new_pool = (char *) realloc (string_space, new_size); - if (new_pool == NULL) - goto out; - - if (__builtin_expect (string_space != new_pool, 0)) - { - size_t i; - - for (i = 0; i < nmap; i++) - { - map[i].alias += new_pool - string_space; - map[i].value += new_pool - string_space; - } - } - - string_space = new_pool; - string_space_max = new_size; - } - - map[nmap].alias = - (const char *) memcpy (&string_space[string_space_act], - alias, alias_len); - string_space_act += alias_len; - - map[nmap].value = - (const char *) memcpy (&string_space[string_space_act], - value, value_len); - string_space_act += value_len; + /* Increase size of memory pool. */ + size_t new_size = (string_space_max + + (alias_len + value_len > 1024 + ? alias_len + value_len : 1024)); + char *new_pool = (char *) realloc (string_space, new_size); + if (new_pool == NULL) + goto out; + + if (__builtin_expect (string_space != new_pool, 0)) + { + size_t i; + + for (i = 0; i < nmap; i++) + { + map[i].alias += new_pool - string_space; + map[i].value += new_pool - string_space; + } + } + + string_space = new_pool; + string_space_max = new_size; + } + + map[nmap].alias = + (const char *) memcpy (&string_space[string_space_act], + alias, alias_len); + string_space_act += alias_len; + + map[nmap].value = + (const char *) memcpy (&string_space[string_space_act], + value, value_len); + string_space_act += value_len; # if defined __GNUC__ && __GNUC__ >= 12 # pragma GCC diagnostic pop # endif - ++nmap; - ++added; - } + ++nmap; + ++added; + } } } diff --git a/gettext-runtime/intl/plural-exp.h b/gettext-runtime/intl/plural-exp.h index 16080d63d..4e178c7f0 100644 --- a/gettext-runtime/intl/plural-exp.h +++ b/gettext-runtime/intl/plural-exp.h @@ -1,5 +1,5 @@ /* Expression parsing and evaluation for plural form selection. - Copyright (C) 2000-2023 Free Software Foundation, Inc. + Copyright (C) 2000-2024 Free Software Foundation, Inc. Written by Ulrich Drepper , 2000. This program is free software: you can redistribute it and/or modify @@ -129,7 +129,7 @@ struct eval_result unsigned long int value; /* Only relevant for status == PE_OK */ }; -#if !defined (_LIBC) && !defined (IN_LIBINTL) && !defined (IN_LIBGLOCALE) +#if !defined (_LIBC) && !defined (IN_LIBINTL) extern struct eval_result plural_eval (const struct expression *pexp, unsigned long int n); #endif