diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-07-12 18:26:36 +0000 |
commit | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch) | |
tree | 2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /intl | |
parent | 7d58530341304d403a6626d7f7a1913165fe2f32 (diff) | |
download | glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.gz glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.bz2 glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip |
2.5-18.1
Diffstat (limited to 'intl')
-rw-r--r-- | intl/Makefile | 53 | ||||
-rw-r--r-- | intl/bindtextdom.c | 28 | ||||
-rw-r--r-- | intl/dcgettext.c | 3 | ||||
-rw-r--r-- | intl/dcigettext.c | 595 | ||||
-rw-r--r-- | intl/explodename.c | 4 | ||||
-rw-r--r-- | intl/finddomain.c | 23 | ||||
-rw-r--r-- | intl/gettextP.h | 45 | ||||
-rw-r--r-- | intl/l10nflist.c | 7 | ||||
-rw-r--r-- | intl/libintl.h | 10 | ||||
-rw-r--r-- | intl/loadmsgcat.c | 172 | ||||
-rw-r--r-- | intl/locale.alias | 2 | ||||
-rw-r--r-- | intl/localealias.c | 7 | ||||
-rw-r--r-- | intl/plural-exp.c | 4 | ||||
-rw-r--r-- | intl/plural-exp.h | 4 | ||||
-rw-r--r-- | intl/tst-codeset.sh | 9 | ||||
-rw-r--r-- | intl/tst-gettext2.sh | 4 | ||||
-rw-r--r-- | intl/tst-gettext3.c | 60 | ||||
-rw-r--r-- | intl/tst-gettext3.sh | 44 | ||||
-rw-r--r-- | intl/tst-gettext4-de.po | 8 | ||||
-rw-r--r-- | intl/tst-gettext4-fr.po | 8 | ||||
-rw-r--r-- | intl/tst-gettext4.c | 151 | ||||
-rwxr-xr-x | intl/tst-gettext4.sh | 44 | ||||
-rw-r--r-- | intl/tst-gettext5.c | 156 | ||||
-rwxr-xr-x | intl/tst-gettext5.sh | 43 | ||||
-rwxr-xr-x | intl/tst-translit.sh | 5 |
25 files changed, 1074 insertions, 415 deletions
diff --git a/intl/Makefile b/intl/Makefile index 32212c0e29..9da445aa38 100644 --- a/intl/Makefile +++ b/intl/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -25,11 +25,22 @@ routines = bindtextdom dcgettext dgettext gettext \ finddomain loadmsgcat localealias textdomain aux = l10nflist explodename plural plural-exp hash-string distribute = gmo.h gettextP.h hash-string.h loadinfo.h locale.alias \ - plural.y plural-exp.h po2test.sed tst-gettext.sh tst-translit.sh \ - translit.po tst-gettext2.sh tstlang1.po tstlang2.po tstcodeset.po\ - tst-codeset.sh plural-eval.c + plural.y plural-exp.h plural-eval.c po2test.sed \ + tst-gettext.sh \ + tst-translit.sh translit.po \ + tst-gettext2.sh tstlang1.po tstlang2.po \ + tst-codeset.sh tstcodeset.po \ + tst-gettext3.sh \ + tst-gettext4.sh tst-gettext4-de.po tst-gettext4-fr.po \ + tst-gettext5.sh -test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset +include ../Makeconfig + +multithread-test-srcs := tst-gettext4 tst-gettext5 +test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3 +ifeq ($(have-thread-library),yes) +test-srcs += $(multithread-test-srcs) +endif tests = tst-ngettext before-compile = $(objpfx)msgs.h @@ -39,8 +50,6 @@ install-others = $(inst_msgcatdir)/locale.alias generated = msgs.h mtrace-tst-gettext tst-gettext.mtrace generated-dirs := domaindir localedir -include ../Makeconfig - ifneq (no,$(BISON)) plural.c: plural.y $(BISON) $(BISONFLAGS) $@ $^ @@ -56,7 +65,10 @@ ifeq (no,$(cross-compiling)) ifeq (yes,$(build-shared)) ifneq ($(strip $(MSGFMT)),:) tests: $(objpfx)tst-translit.out $(objpfx)tst-gettext2.out \ - $(objpfx)tst-codeset.out + $(objpfx)tst-codeset.out $(objpfx)tst-gettext3.out +ifeq ($(have-thread-library),yes) +tests: $(objpfx)tst-gettext4.out $(objpfx)tst-gettext5.out +endif ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-gettext endif @@ -72,6 +84,12 @@ $(objpfx)tst-gettext2.out: tst-gettext2.sh $(objpfx)tst-gettext2 $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ $(objpfx)tst-codeset.out: tst-codeset.sh $(objpfx)tst-codeset $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ +$(objpfx)tst-gettext3.out: tst-gettext3.sh $(objpfx)tst-gettext3 + $(SHELL) -e $< $(common-objpfx) $(common-objpfx)intl/ +$(objpfx)tst-gettext4.out: tst-gettext4.sh $(objpfx)tst-gettext4 + $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/ +$(objpfx)tst-gettext5.out: tst-gettext5.sh $(objpfx)tst-gettext5 + $(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/ endif endif @@ -80,13 +98,30 @@ $(objpfx)msgs.h: po2test.sed ../po/de.po LC_ALL=C sed -f $^ > $@ CFLAGS-tst-gettext.c = -DTESTSTRS_H=\"$(objpfx)msgs.h\" -CFLAGS-tst-gettext2.c = -DOBJPFX=\"$(objpfx)\" CFLAGS-tst-translit.c = -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-gettext2.c = -DOBJPFX=\"$(objpfx)\" CFLAGS-tst-codeset.c = -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-gettext3.c = -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-gettext4.c = -DOBJPFX=\"$(objpfx)\" +CFLAGS-tst-gettext5.c = -DOBJPFX=\"$(objpfx)\" + +ifeq ($(have-thread-library),yes) +ifeq (yes,$(build-shared)) +$(addprefix $(objpfx),$(multithread-test-srcs)): $(shared-thread-library) +else +$(addprefix $(objpfx),$(multithread-test-srcs)): $(static-thread-library) +endif +ifeq (yes,$(build-bounded)) +$(multithread-test-srcs:%=$(objpfx)%-bp): $(bounded-thread-library) +endif +endif $(objpfx)tst-translit.out: $(objpfx)tst-gettext.out $(objpfx)tst-gettext2.out: $(objpfx)tst-gettext.out $(objpfx)tst-codeset.out: $(objpfx)tst-gettext.out +$(objpfx)tst-gettext3.out: $(objpfx)tst-gettext.out +$(objpfx)tst-gettext4.out: $(objpfx)tst-gettext.out +$(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out CPPFLAGS += -D'LOCALEDIR="$(msgcatdir)"' \ -D'LOCALE_ALIAS_PATH="$(msgcatdir)"' diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c index 39256ed566..fd527a180a 100644 --- a/intl/bindtextdom.c +++ b/intl/bindtextdom.c @@ -1,5 +1,5 @@ /* Implementation of the bindtextdomain(3) function - Copyright (C) 1995-1998, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -60,9 +60,7 @@ /* Contains the default location of the message catalogs. */ extern const char _nl_default_dirname[]; #ifdef _LIBC -extern const char _nl_default_dirname_internal[] attribute_hidden; -#else -# define INTUSE(name) name +libc_hidden_proto (_nl_default_dirname) #endif /* List with bindings of specific domains. */ @@ -152,8 +150,8 @@ set_binding_values (domainname, dirnamep, codesetp) char *result = binding->dirname; if (strcmp (dirname, result) != 0) { - if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0) - result = (char *) INTUSE(_nl_default_dirname); + if (strcmp (dirname, _nl_default_dirname) == 0) + result = (char *) _nl_default_dirname; else { #if defined _LIBC || defined HAVE_STRDUP @@ -168,7 +166,7 @@ set_binding_values (domainname, dirnamep, codesetp) if (__builtin_expect (result != NULL, 1)) { - if (binding->dirname != INTUSE(_nl_default_dirname)) + if (binding->dirname != _nl_default_dirname) free (binding->dirname); binding->dirname = result; @@ -209,7 +207,6 @@ set_binding_values (domainname, dirnamep, codesetp) free (binding->codeset); binding->codeset = result; - ++binding->codeset_cntr; modified = 1; } } @@ -222,7 +219,7 @@ set_binding_values (domainname, dirnamep, codesetp) { /* Simply return the default values. */ if (dirnamep) - *dirnamep = INTUSE(_nl_default_dirname); + *dirnamep = _nl_default_dirname; if (codesetp) *codesetp = NULL; } @@ -244,11 +241,11 @@ set_binding_values (domainname, dirnamep, codesetp) if (dirname == NULL) /* The default value. */ - dirname = INTUSE(_nl_default_dirname); + dirname = _nl_default_dirname; else { - if (strcmp (dirname, INTUSE(_nl_default_dirname)) == 0) - dirname = INTUSE(_nl_default_dirname); + if (strcmp (dirname, _nl_default_dirname) == 0) + dirname = _nl_default_dirname; else { char *result; @@ -271,9 +268,7 @@ set_binding_values (domainname, dirnamep, codesetp) } else /* The default value. */ - new_binding->dirname = (char *) INTUSE(_nl_default_dirname); - - new_binding->codeset_cntr = 0; + new_binding->dirname = (char *) _nl_default_dirname; if (codesetp) { @@ -295,7 +290,6 @@ set_binding_values (domainname, dirnamep, codesetp) memcpy (result, codeset, len); #endif codeset = result; - ++new_binding->codeset_cntr; } *codesetp = codeset; new_binding->codeset = (char *) codeset; @@ -327,7 +321,7 @@ set_binding_values (domainname, dirnamep, codesetp) if (0) { failed_codeset: - if (new_binding->dirname != INTUSE(_nl_default_dirname)) + if (new_binding->dirname != _nl_default_dirname) free (new_binding->dirname); failed_dirname: free (new_binding); diff --git a/intl/dcgettext.c b/intl/dcgettext.c index 55f81eb887..edf98b6973 100644 --- a/intl/dcgettext.c +++ b/intl/dcgettext.c @@ -1,5 +1,5 @@ /* Implementation of the dcgettext(3) function. - Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -57,4 +57,5 @@ DCGETTEXT (domainname, msgid, category) /* Alias for function name in GNU C Library. */ INTDEF(__dcgettext) weak_alias (__dcgettext, dcgettext); +libc_hidden_def (__dcgettext) #endif diff --git a/intl/dcigettext.c b/intl/dcigettext.c index d7111729b9..cb2b1813a7 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -1,5 +1,5 @@ /* Implementation of the internal dcigettext function. - Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -172,16 +172,26 @@ static void *mempcpy PARAMS ((void *dest, const void *src, size_t n)); # define PATH_MAX _POSIX_PATH_MAX #endif +/* Whether to support different locales in different threads. */ +#if defined _LIBC || HAVE_NL_LOCALE_NAME +# define HAVE_PER_THREAD_LOCALE +#endif + /* This is the type used for the search tree where known translations are stored. */ struct known_translation_t { /* Domain in which to search. */ - char *domainname; + const char *domainname; /* The category. */ int category; +#ifdef HAVE_PER_THREAD_LOCALE + /* Name of the relevant locale category, or "" for the global locale. */ + const char *localename; +#endif + /* State of the catalog counter at the point the string was found. */ int counter; @@ -226,23 +236,22 @@ transcmp (p1, p2) { result = strcmp (s1->domainname, s2->domainname); if (result == 0) - /* 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; + { +#ifdef HAVE_PER_THREAD_LOCALE + result = strcmp (s1->localename, s2->localename); + 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; + } } return result; } #endif -#ifndef INTVARDEF -# define INTVARDEF -#endif -#ifndef INTUSE -# define INTUSE(name) name -#endif - /* Name of the default domain used for gettext(3) prior any call to textdomain(3). The default value for this is "messages". */ const char _nl_default_default_domain[] attribute_hidden = "messages"; @@ -252,8 +261,15 @@ const char *_nl_current_default_domain attribute_hidden = _nl_default_default_domain; /* Contains the default location of the message catalogs. */ + +#ifdef _LIBC +extern const char _nl_default_dirname[]; +libc_hidden_proto (_nl_default_dirname) +#endif const char _nl_default_dirname[] = LOCALEDIR; -INTVARDEF (_nl_default_dirname) +#ifdef _LIBC +libc_hidden_data_def (_nl_default_dirname) +#endif /* List with bindings of specific domains created by bindtextdomain() calls. */ @@ -270,7 +286,8 @@ static const char *guess_category_value PARAMS ((int category, internal_function; #ifdef _LIBC # include "../locale/localeinfo.h" -# define category_to_name(category) _nl_category_names[category] +# define category_to_name(category) \ + _nl_category_names.str + _nl_category_name_idxs[category] #else static const char *category_to_name PARAMS ((int category)) internal_function; #endif @@ -326,6 +343,10 @@ static struct transmem_list *transmem_list; #else typedef unsigned char transmem_block_t; #endif +#if defined _LIBC || HAVE_ICONV +static const char *get_output_charset PARAMS ((struct binding *domainbinding)) + internal_function; +#endif /* Names for the libintl functions are a problem. They must not clash @@ -404,6 +425,9 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) struct known_translation_t *search; struct known_translation_t **foundp = NULL; size_t msgid_len; +# ifdef HAVE_PER_THREAD_LOCALE + const char *localename; +# endif #endif size_t domainname_len; @@ -436,8 +460,14 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) search = (struct known_translation_t *) alloca (offsetof (struct known_translation_t, msgid) + msgid_len); memcpy (search->msgid, msgid1, msgid_len); - search->domainname = (char *) domainname; + search->domainname = domainname; search->category = category; +# ifdef HAVE_PER_THREAD_LOCALE +# ifdef _LIBC + localename = __current_locale_name (category); +# endif + search->localename = localename; +# endif /* Since tfind/tsearch manage a balanced tree, concurrent tfind and tsearch calls can be fatal. */ @@ -485,7 +515,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) } if (binding == NULL) - dirname = (char *) INTUSE(_nl_default_dirname); + dirname = (char *) _nl_default_dirname; else if (binding->dirname[0] == '/') dirname = binding->dirname; else @@ -581,6 +611,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) if (strcmp (single_locale, "C") == 0 || strcmp (single_locale, "POSIX") == 0) { + no_translation: FREE_BLOCKS (block_list); __libc_rwlock_unlock (_nl_state_lock); __set_errno (saved_errno); @@ -597,7 +628,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) if (domain != NULL) { - retval = _nl_find_msg (domain, binding, msgid1, &retlen); + retval = _nl_find_msg (domain, binding, msgid1, 1, &retlen); if (retval == NULL) { @@ -606,7 +637,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) for (cnt = 0; domain->successor[cnt] != NULL; ++cnt) { retval = _nl_find_msg (domain->successor[cnt], binding, - msgid1, &retlen); + msgid1, 1, &retlen); if (retval != NULL) { @@ -616,6 +647,12 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) } } + /* Returning -1 means that some resource problem exists + (likely memory) and that the strings could not be + converted. Return the original strings. */ + if (__builtin_expect (retval == (char *) -1, 0)) + goto no_translation; + if (retval != NULL) { /* Found the translation of MSGID1 in domain DOMAIN: @@ -625,17 +662,33 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) if (foundp == NULL) { /* Create a new entry and add it to the search tree. */ + size_t size; struct known_translation_t *newp; - newp = (struct known_translation_t *) - malloc (offsetof (struct known_translation_t, msgid) - + msgid_len + domainname_len + 1); + size = offsetof (struct known_translation_t, msgid) + + msgid_len + domainname_len + 1; +# ifdef HAVE_PER_THREAD_LOCALE + size += strlen (localename) + 1; +# endif + newp = (struct known_translation_t *) malloc (size); if (newp != NULL) { - newp->domainname = - mempcpy (newp->msgid, msgid1, msgid_len); - memcpy (newp->domainname, domainname, domainname_len + 1); + char *new_domainname; +# ifdef HAVE_PER_THREAD_LOCALE + char *new_localename; +# endif + + new_domainname = mempcpy (newp->msgid, msgid1, msgid_len); + memcpy (new_domainname, domainname, domainname_len + 1); +# ifdef HAVE_PER_THREAD_LOCALE + new_localename = new_domainname + domainname_len + 1; + strcpy (new_localename, localename); +# endif + newp->domainname = new_domainname; newp->category = category; +# ifdef HAVE_PER_THREAD_LOCALE + newp->localename = new_localename; +# endif newp->counter = _nl_msg_cat_cntr; newp->domain = domain; newp->translation = retval; @@ -681,10 +734,11 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category) char * internal_function -_nl_find_msg (domain_file, domainbinding, msgid, lengthp) +_nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp) struct loaded_l10nfile *domain_file; struct binding *domainbinding; const char *msgid; + int convert; size_t *lengthp; { struct loaded_domain *domain; @@ -791,195 +845,331 @@ _nl_find_msg (domain_file, domainbinding, msgid, lengthp) } #if defined _LIBC || HAVE_ICONV - if (domain->codeset_cntr - != (domainbinding != NULL ? domainbinding->codeset_cntr : 0)) + if (convert) { - /* The domain's codeset has changed through bind_textdomain_codeset() - since the message catalog was initialized or last accessed. We - have to reinitialize the converter. */ - _nl_free_domain_conv (domain); - _nl_init_domain_conv (domain_file, domain, domainbinding); - } + /* We are supposed to do a conversion. */ + const char *encoding = get_output_charset (domainbinding); + + /* Search whether a table with converted translations for this + encoding has already been allocated. */ + size_t nconversions = domain->nconversions; + struct converted_domain *convd = NULL; + size_t i; - if ( + for (i = nconversions; i > 0; ) + { + i--; + if (strcmp (domain->conversions[i].encoding, encoding) == 0) + { + convd = &domain->conversions[i]; + break; + } + } + + if (convd == NULL) + { + /* Allocate a table for the converted translations for this + encoding. */ + struct converted_domain *new_conversions = + (struct converted_domain *) + realloc (domain->conversions, + (nconversions + 1) * sizeof (struct converted_domain)); + + if (__builtin_expect (new_conversions == NULL, 0)) + /* Nothing we can do, no more memory. We cannot use the + translation because it might be encoded incorrectly. */ + return (char *) -1; + + domain->conversions = new_conversions; + + /* Copy the 'encoding' string to permanent storage. */ + encoding = strdup (encoding); + if (__builtin_expect (encoding == NULL, 0)) + /* Nothing we can do, no more memory. We cannot use the + translation because it might be encoded incorrectly. */ + return (char *) -1; + + convd = &new_conversions[nconversions]; + convd->encoding = encoding; + + /* Find out about the character set the file is encoded with. + This can be found (in textual form) in the entry "". If this + entry does not exist or if this does not contain the 'charset=' + information, we will assume the charset matches the one the + current locale and we don't have to perform any conversion. */ # ifdef _LIBC - domain->conv != (__gconv_t) -1 + convd->conv = (__gconv_t) -1; # else # if HAVE_ICONV - domain->conv != (iconv_t) -1 + convd->conv = (iconv_t) -1; # endif # endif - ) - { - /* We are supposed to do a conversion. First allocate an - appropriate table with the same structure as the table - of translations in the file, where we can put the pointers - to the converted strings in. - There is a slight complication with plural entries. They - are represented by consecutive NUL terminated strings. We - handle this case by converting RESULTLEN bytes, including - NULs. */ - - if (domain->conv_tab == NULL - && ((domain->conv_tab = - (char **) calloc (nstrings + domain->n_sysdep_strings, - sizeof (char *))) - == NULL)) - /* Mark that we didn't succeed allocating a table. */ - domain->conv_tab = (char **) -1; - - if (__builtin_expect (domain->conv_tab == (char **) -1, 0)) - /* Nothing we can do, no more memory. */ - goto converted; - - if (domain->conv_tab[act] == NULL) + { + char *nullentry; + size_t nullentrylen; + + /* Get the header entry. This is a recursion, but it doesn't + reallocate domain->conversions because we pass convert = 0. */ + nullentry = + _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen); + + if (nullentry != NULL) + { + const char *charsetstr; + + charsetstr = strstr (nullentry, "charset="); + if (charsetstr != NULL) + { + size_t len; + char *charset; + const char *outcharset; + + charsetstr += strlen ("charset="); + len = strcspn (charsetstr, " \t\n"); + + charset = (char *) alloca (len + 1); +# if defined _LIBC || HAVE_MEMPCPY + *((char *) mempcpy (charset, charsetstr, len)) = '\0'; +# else + memcpy (charset, charsetstr, len); + charset[len] = '\0'; +# endif + + outcharset = encoding; + +# ifdef _LIBC + /* We always want to use transliteration. */ + outcharset = norm_add_slashes (outcharset, "TRANSLIT"); + charset = norm_add_slashes (charset, ""); + int r = __gconv_open (outcharset, charset, &convd->conv, + GCONV_AVOID_NOCONV); + if (__builtin_expect (r != __GCONV_OK, 0)) + { + /* If the output encoding is the same there is + nothing to do. Otherwise do not use the + translation at all. */ + if (__builtin_expect (r != __GCONV_NOCONV, 1)) + return NULL; + + convd->conv = (__gconv_t) -1; + } +# else +# if HAVE_ICONV + /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5, + we want to use transliteration. */ +# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \ + || _LIBICONV_VERSION >= 0x0105 + if (strchr (outcharset, '/') == NULL) + { + char *tmp; + + len = strlen (outcharset); + tmp = (char *) alloca (len + 10 + 1); + memcpy (tmp, outcharset, len); + memcpy (tmp + len, "//TRANSLIT", 10 + 1); + outcharset = tmp; + + convd->conv = iconv_open (outcharset, charset); + + freea (outcharset); + } + else +# endif + convd->conv = iconv_open (outcharset, charset); +# endif +# endif + + freea (charset); + } + } + } + convd->conv_tab = NULL; + /* Here domain->conversions is still == new_conversions. */ + domain->nconversions++; + } + + if ( +# ifdef _LIBC + convd->conv != (__gconv_t) -1 +# else +# if HAVE_ICONV + convd->conv != (iconv_t) -1 +# endif +# endif + ) { - /* We haven't used this string so far, so it is not - translated yet. Do this now. */ - /* We use a bit more efficient memory handling. - We allocate always larger blocks which get used over - time. This is faster than many small allocations. */ - __libc_lock_define_initialized (static, lock) + /* We are supposed to do a conversion. First allocate an + appropriate table with the same structure as the table + of translations in the file, where we can put the pointers + to the converted strings in. + There is a slight complication with plural entries. They + are represented by consecutive NUL terminated strings. We + handle this case by converting RESULTLEN bytes, including + NULs. */ + + if (convd->conv_tab == NULL + && ((convd->conv_tab = + (char **) calloc (nstrings + domain->n_sysdep_strings, + sizeof (char *))) + == NULL)) + /* Mark that we didn't succeed allocating a table. */ + convd->conv_tab = (char **) -1; + + if (__builtin_expect (convd->conv_tab == (char **) -1, 0)) + /* Nothing we can do, no more memory. We cannot use the + translation because it might be encoded incorrectly. */ + return (char *) -1; + + if (convd->conv_tab[act] == NULL) + { + /* We haven't used this string so far, so it is not + translated yet. Do this now. */ + /* We use a bit more efficient memory handling. + We allocate always larger blocks which get used over + time. This is faster than many small allocations. */ + __libc_lock_define_initialized (static, lock) # define INITIAL_BLOCK_SIZE 4080 - static unsigned char *freemem; - static size_t freemem_size; + static unsigned char *freemem; + static size_t freemem_size; - const unsigned char *inbuf; - unsigned char *outbuf; - int malloc_count; + const unsigned char *inbuf; + unsigned char *outbuf; + int malloc_count; # ifndef _LIBC - transmem_block_t *transmem_list = NULL; + transmem_block_t *transmem_list = NULL; # endif - __libc_lock_lock (lock); + __libc_lock_lock (lock); - inbuf = (const unsigned char *) result; - outbuf = freemem + sizeof (size_t); + inbuf = (const unsigned char *) result; + outbuf = freemem + sizeof (size_t); - malloc_count = 0; - while (1) - { - transmem_block_t *newmem; + malloc_count = 0; + while (1) + { + transmem_block_t *newmem; # ifdef _LIBC - size_t non_reversible; - int res; + size_t non_reversible; + int res; - if (freemem_size < sizeof (size_t)) - goto resize_freemem; + if (freemem_size < sizeof (size_t)) + goto resize_freemem; - res = __gconv (domain->conv, - &inbuf, inbuf + resultlen, - &outbuf, - outbuf + freemem_size - sizeof (size_t), - &non_reversible); + res = __gconv (convd->conv, + &inbuf, inbuf + resultlen, + &outbuf, + outbuf + freemem_size - sizeof (size_t), + &non_reversible); - if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) - break; + if (res == __GCONV_OK || res == __GCONV_EMPTY_INPUT) + break; - if (res != __GCONV_FULL_OUTPUT) - { - __libc_lock_unlock (lock); - goto converted; - } + if (res != __GCONV_FULL_OUTPUT) + { + /* We should not use the translation at all, it + is incorrectly encoded. */ + __libc_lock_unlock (lock); + return NULL; + } - inbuf = result; + inbuf = (const unsigned char *) result; # else # if HAVE_ICONV - const char *inptr = (const char *) inbuf; - size_t inleft = resultlen; - char *outptr = (char *) outbuf; - size_t outleft; - - if (freemem_size < sizeof (size_t)) - goto resize_freemem; - - outleft = freemem_size - sizeof (size_t); - if (iconv (domain->conv, - (ICONV_CONST char **) &inptr, &inleft, - &outptr, &outleft) - != (size_t) (-1)) - { - outbuf = (unsigned char *) outptr; - break; - } - if (errno != E2BIG) - { - __libc_lock_unlock (lock); - goto converted; - } + const char *inptr = (const char *) inbuf; + size_t inleft = resultlen; + char *outptr = (char *) outbuf; + size_t outleft; + + if (freemem_size < sizeof (size_t)) + goto resize_freemem; + + outleft = freemem_size - sizeof (size_t); + if (iconv (convd->conv, + (ICONV_CONST char **) &inptr, &inleft, + &outptr, &outleft) + != (size_t) (-1)) + { + outbuf = (unsigned char *) outptr; + break; + } + if (errno != E2BIG) + { + __libc_lock_unlock (lock); + return NULL; + } # endif # endif - resize_freemem: - /* We must allocate a new buffer or resize the old one. */ - if (malloc_count > 0) - { - ++malloc_count; - freemem_size = malloc_count * INITIAL_BLOCK_SIZE; - newmem = (transmem_block_t *) realloc (transmem_list, - freemem_size); + resize_freemem: + /* We must allocate a new buffer or resize the old one. */ + if (malloc_count > 0) + { + ++malloc_count; + freemem_size = malloc_count * INITIAL_BLOCK_SIZE; + newmem = (transmem_block_t *) realloc (transmem_list, + freemem_size); # ifdef _LIBC - if (newmem != NULL) - transmem_list = transmem_list->next; + if (newmem != NULL) + transmem_list = transmem_list->next; + else + { + struct transmem_list *old = transmem_list; + + transmem_list = transmem_list->next; + free (old); + } +# endif + } else { - struct transmem_list *old = transmem_list; - - transmem_list = transmem_list->next; - free (old); + malloc_count = 1; + freemem_size = INITIAL_BLOCK_SIZE; + newmem = (transmem_block_t *) malloc (freemem_size); + } + if (__builtin_expect (newmem == NULL, 0)) + { + freemem = NULL; + freemem_size = 0; + __libc_lock_unlock (lock); + return (char *) -1; } -# endif - } - else - { - malloc_count = 1; - freemem_size = INITIAL_BLOCK_SIZE; - newmem = (transmem_block_t *) malloc (freemem_size); - } - if (__builtin_expect (newmem == NULL, 0)) - { - freemem = NULL; - freemem_size = 0; - __libc_lock_unlock (lock); - goto converted; - } # ifdef _LIBC - /* Add the block to the list of blocks we have to free - at some point. */ - newmem->next = transmem_list; - transmem_list = newmem; + /* Add the block to the list of blocks we have to free + at some point. */ + newmem->next = transmem_list; + transmem_list = newmem; - freemem = newmem->data; - freemem_size -= offsetof (struct transmem_list, data); + freemem = (unsigned char *) newmem->data; + freemem_size -= offsetof (struct transmem_list, data); # else - transmem_list = newmem; - freemem = newmem; + transmem_list = newmem; + freemem = newmem; # endif - outbuf = freemem + sizeof (size_t); + outbuf = freemem + sizeof (size_t); + } + + /* We have now in our buffer a converted string. Put this + into the table of conversions. */ + *(size_t *) freemem = outbuf - freemem - sizeof (size_t); + convd->conv_tab[act] = (char *) freemem; + /* Shrink freemem, but keep it aligned. */ + freemem_size -= outbuf - freemem; + freemem = outbuf; + freemem += freemem_size & (alignof (size_t) - 1); + freemem_size = freemem_size & ~ (alignof (size_t) - 1); + + __libc_lock_unlock (lock); } - /* We have now in our buffer a converted string. Put this - into the table of conversions. */ - *(size_t *) freemem = outbuf - freemem - sizeof (size_t); - domain->conv_tab[act] = (char *) freemem; - /* Shrink freemem, but keep it aligned. */ - freemem_size -= outbuf - freemem; - freemem = outbuf; - freemem += freemem_size & (alignof (size_t) - 1); - freemem_size = freemem_size & ~ (alignof (size_t) - 1); - - __libc_lock_unlock (lock); + /* Now convd->conv_tab[act] contains the translation of all + the plural variants. */ + result = convd->conv_tab[act] + sizeof (size_t); + resultlen = *(size_t *) convd->conv_tab[act]; } - - /* Now domain->conv_tab[act] contains the translation of all - the plural variants. */ - result = domain->conv_tab[act] + sizeof (size_t); - resultlen = *(size_t *) domain->conv_tab[act]; } - converted: /* The result string is converted. */ #endif /* _LIBC || HAVE_ICONV */ @@ -1120,6 +1310,61 @@ guess_category_value (category, categoryname) return language != NULL && strcmp (retval, "C") != 0 ? language : retval; } +#if defined _LIBC || HAVE_ICONV +/* Returns the output charset. */ +static const char * +internal_function +get_output_charset (domainbinding) + struct binding *domainbinding; +{ + /* The output charset should normally be determined by the locale. But + sometimes the locale is not used or not correctly set up, so we provide + a possibility for the user to override this: the OUTPUT_CHARSET + environment variable. Moreover, the value specified through + bind_textdomain_codeset overrides both. */ + if (domainbinding != NULL && domainbinding->codeset != NULL) + return domainbinding->codeset; + else + { + /* For speed reasons, we look at the value of OUTPUT_CHARSET only + once. This is a user variable that is not supposed to change + during a program run. */ + static char *output_charset_cache; + static int output_charset_cached; + + if (!output_charset_cached) + { + const char *value = getenv ("OUTPUT_CHARSET"); + + if (value != NULL && value[0] != '\0') + { + size_t len = strlen (value) + 1; + char *value_copy = (char *) malloc (len); + + if (value_copy != NULL) + memcpy (value_copy, value, len); + output_charset_cache = value_copy; + } + output_charset_cached = 1; + } + + if (output_charset_cache != NULL) + return output_charset_cache; + else + { +# ifdef _LIBC + return _NL_CURRENT (LC_CTYPE, CODESET); +# else +# if HAVE_ICONV + extern const char *locale_charset PARAMS ((void); + return locale_charset (); +# endif +# endif + } + } +} +#endif + /* @@ begin of epilog @@ */ /* We don't want libintl.a to depend on any other library. So we @@ -1161,7 +1406,7 @@ libc_freeres_fn (free_mem) { struct binding *oldp = _nl_domain_bindings; _nl_domain_bindings = _nl_domain_bindings->next; - if (oldp->dirname != INTUSE(_nl_default_dirname)) + if (oldp->dirname != _nl_default_dirname) /* Yes, this is a pointer comparison. */ free (oldp->dirname); free (oldp->codeset); diff --git a/intl/explodename.c b/intl/explodename.c index f7bcfa5ff6..8e326ead53 100644 --- a/intl/explodename.c +++ b/intl/explodename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -78,7 +78,7 @@ _nl_explode_name (name, language, modifier, territory, codeset, if (*language == cp) /* This does not make sense: language has to be specified. Use this entry as it is without exploding. Perhaps it is an alias. */ - cp = strchr (*language, '\0'); + cp = __rawmemchr (*language, '\0'); else if (cp[0] != '@') { if (cp[0] == '_') diff --git a/intl/finddomain.c b/intl/finddomain.c index 39e54755d2..9806ba12cd 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,5 +1,5 @@ /* Handle list of needed message catalogs - Copyright (C) 1995-1999, 2000, 2001, 2002, 2004 + Copyright (C) 1995-1999, 2000, 2001, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -110,7 +110,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) break; } - return cnt >= 0 ? retval : NULL; + return retval; /* NOTREACHED */ } @@ -119,20 +119,7 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) done. */ alias_value = _nl_expand_alias (locale); if (alias_value != NULL) - { -#if defined _LIBC || defined HAVE_STRDUP - locale = strdup (alias_value); - if (locale == NULL) - return NULL; -#else - size_t len = strlen (alias_value) + 1; - locale = (char *) malloc (len); - if (locale == NULL) - return NULL; - - memcpy (locale, alias_value, len); -#endif - } + locale = strdupa (alias_value); /* Now we determine the single parts of the locale name. First look for the language. Termination symbols are `_' and `@' if @@ -169,10 +156,6 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) } } - /* The room for an alias was dynamically allocated. Free it now. */ - if (alias_value != NULL) - free (locale); - /* The space for normalized_codeset is dynamically allocated. Free it. */ if (mask & XPG_NORM_CODESET) free ((void *) normalized_codeset); diff --git a/intl/gettextP.h b/intl/gettextP.h index 46b51e1008..f18535a5b3 100644 --- a/intl/gettextP.h +++ b/intl/gettextP.h @@ -1,5 +1,5 @@ /* Header describing internals of libintl library. - Copyright (C) 1995-1999, 2000, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-1999, 2000, 2001, 2004-2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@cygnus.com>, 1995. @@ -88,6 +88,26 @@ struct sysdep_string_desc const char *pointer; }; +/* Cache of translated strings after charset conversion. + Note: The strings are converted to the target encoding only on an as-needed + basis. */ +struct converted_domain +{ + /* The target encoding name. */ + const char *encoding; + /* The descriptor for conversion from the message catalog's encoding to + this target encoding. */ +#ifdef _LIBC + __gconv_t conv; +#else +# if HAVE_ICONV + iconv_t conv; +# endif +#endif + /* The table of translated strings after charset conversion. */ + char **conv_tab; +}; + /* The representation of an opened message catalog. */ struct loaded_domain { @@ -123,15 +143,9 @@ struct loaded_domain /* 1 if the hash table uses a different endianness than this machine. */ int must_swap_hash_tab; - int codeset_cntr; -#ifdef _LIBC - __gconv_t conv; -#else -# if HAVE_ICONV - iconv_t conv; -# endif -#endif - char **conv_tab; + /* Cache of charset conversions of the translated strings. */ + struct converted_domain *conversions; + size_t nconversions; struct expression *plural; unsigned long int nplurals; @@ -151,7 +165,6 @@ struct binding { struct binding *next; char *dirname; - int codeset_cntr; /* Incremented each time codeset changes. */ char *codeset; char domainname[ZERO]; }; @@ -173,16 +186,10 @@ struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname, void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain, struct binding *__domainbinding)) internal_function; -const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file, - struct loaded_domain *__domain, - struct binding *__domainbinding)) - internal_function; -void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain)) - internal_function; char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file, - struct binding *domainbinding, - const char *msgid, size_t *lengthp)) + struct binding *domainbinding, const char *msgid, + int convert, size_t *lengthp)) internal_function; #ifdef _LIBC diff --git a/intl/l10nflist.c b/intl/l10nflist.c index 7ffb4ab590..2c06a91113 100644 --- a/intl/l10nflist.c +++ b/intl/l10nflist.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -270,7 +270,10 @@ _nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language, * (1 << pop (mask)) * sizeof (struct loaded_l10nfile *))); if (retval == NULL) - return NULL; + { + free (abs_filename); + return NULL; + } retval->filename = abs_filename; /* If more than one directory is in the list this is a pseudo-entry diff --git a/intl/libintl.h b/intl/libintl.h index 6561c78370..544dec3533 100644 --- a/intl/libintl.h +++ b/intl/libintl.h @@ -1,5 +1,5 @@ /* Message catalogs for internationalization. - Copyright (C) 1995-1999, 2000-2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. This file is derived from the file libgettext.h in the GNU gettext package. @@ -37,19 +37,21 @@ __BEGIN_DECLS /* Look up MSGID in the current default message catalog for the current LC_MESSAGES locale. If not found, returns MSGID itself (the default text). */ -extern char *gettext (__const char *__msgid) __THROW; +extern char *gettext (__const char *__msgid) + __THROW __attribute_format_arg__ (1); /* Look up MSGID in the DOMAINNAME message catalog for the current LC_MESSAGES locale. */ extern char *dgettext (__const char *__domainname, __const char *__msgid) - __THROW; + __THROW __attribute_format_arg__ (2); extern char *__dgettext (__const char *__domainname, __const char *__msgid) __THROW __attribute_format_arg__ (2); /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY locale. */ extern char *dcgettext (__const char *__domainname, - __const char *__msgid, int __category) __THROW; + __const char *__msgid, int __category) + __THROW __attribute_format_arg__ (2); extern char *__dcgettext (__const char *__domainname, __const char *__msgid, int __category) __THROW __attribute_format_arg__ (2); diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c index efefc69a43..1f55531097 100644 --- a/intl/loadmsgcat.c +++ b/intl/loadmsgcat.c @@ -1,5 +1,5 @@ /* Load needed message catalogs. - Copyright (C) 1995-2004 Free Software Foundation, Inc. + Copyright (C) 1995-2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -752,146 +752,6 @@ get_sysdep_segment_value (name) return NULL; } -/* Initialize the codeset dependent parts of an opened message catalog. - Return the header entry. */ -const char * -internal_function -_nl_init_domain_conv (domain_file, domain, domainbinding) - struct loaded_l10nfile *domain_file; - struct loaded_domain *domain; - struct binding *domainbinding; -{ - /* Find out about the character set the file is encoded with. - This can be found (in textual form) in the entry "". If this - entry does not exist or if this does not contain the `charset=' - information, we will assume the charset matches the one the - current locale and we don't have to perform any conversion. */ - char *nullentry; - size_t nullentrylen; - - /* Preinitialize fields, to avoid recursion during _nl_find_msg. */ - domain->codeset_cntr = - (domainbinding != NULL ? domainbinding->codeset_cntr : 0); -#ifdef _LIBC - domain->conv = (__gconv_t) -1; -#else -# if HAVE_ICONV - domain->conv = (iconv_t) -1; -# endif -#endif - domain->conv_tab = NULL; - - /* Get the header entry. */ - nullentry = _nl_find_msg (domain_file, domainbinding, "", &nullentrylen); - - if (nullentry != NULL) - { -#if defined _LIBC || HAVE_ICONV - const char *charsetstr; - - charsetstr = strstr (nullentry, "charset="); - if (charsetstr != NULL) - { - size_t len; - char *charset; - const char *outcharset; - - charsetstr += strlen ("charset="); - len = strcspn (charsetstr, " \t\n"); - - charset = (char *) alloca (len + 1); -# if defined _LIBC || HAVE_MEMPCPY - *((char *) mempcpy (charset, charsetstr, len)) = '\0'; -# else - memcpy (charset, charsetstr, len); - charset[len] = '\0'; -# endif - - /* The output charset should normally be determined by the - locale. But sometimes the locale is not used or not correctly - set up, so we provide a possibility for the user to override - this. Moreover, the value specified through - bind_textdomain_codeset overrides both. */ - if (domainbinding != NULL && domainbinding->codeset != NULL) - outcharset = domainbinding->codeset; - else - { - outcharset = getenv ("OUTPUT_CHARSET"); - if (outcharset == NULL || outcharset[0] == '\0') - { -# ifdef _LIBC - outcharset = _NL_CURRENT (LC_CTYPE, CODESET); -# else -# if HAVE_ICONV - extern const char *locale_charset PARAMS ((void)); - outcharset = locale_charset (); -# endif -# endif - } - } - -# ifdef _LIBC - /* We always want to use transliteration. */ - outcharset = norm_add_slashes (outcharset, "TRANSLIT"); - charset = norm_add_slashes (charset, ""); - if (__gconv_open (outcharset, charset, &domain->conv, - GCONV_AVOID_NOCONV) - != __GCONV_OK) - domain->conv = (__gconv_t) -1; -# else -# if HAVE_ICONV - /* When using GNU libc >= 2.2 or GNU libiconv >= 1.5, - we want to use transliteration. */ -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 \ - || _LIBICONV_VERSION >= 0x0105 - if (strchr (outcharset, '/') == NULL) - { - char *tmp; - - len = strlen (outcharset); - tmp = (char *) alloca (len + 10 + 1); - memcpy (tmp, outcharset, len); - memcpy (tmp + len, "//TRANSLIT", 10 + 1); - outcharset = tmp; - - domain->conv = iconv_open (outcharset, charset); - - freea (outcharset); - } - else -# endif - domain->conv = iconv_open (outcharset, charset); -# endif -# endif - - freea (charset); - } -#endif /* _LIBC || HAVE_ICONV */ - } - - return nullentry; -} - -/* Frees the codeset dependent parts of an opened message catalog. */ -void -internal_function -_nl_free_domain_conv (domain) - struct loaded_domain *domain; -{ - if (domain->conv_tab != NULL && domain->conv_tab != (char **) -1) - free (domain->conv_tab); - -#ifdef _LIBC - if (domain->conv != (__gconv_t) -1) - __gconv_close (domain->conv); -#else -# if HAVE_ICONV - if (domain->conv != (iconv_t) -1) - iconv_close (domain->conv); -# endif -#endif -} - /* Load the message catalogs specified by FILENAME. If it is no valid message catalog do nothing. */ void @@ -913,6 +773,7 @@ _nl_load_domain (domain_file, domainbinding) struct loaded_domain *domain; int revision; const char *nullentry; + size_t nullentrylen; __libc_lock_lock_recursive (lock); if (domain_file->decided != 0) @@ -920,8 +781,8 @@ _nl_load_domain (domain_file, domainbinding) /* There are two possibilities: + is is the same thread calling again during this - initialization via _nl_init_domain_conv and _nl_find_msg. We - have initialized everything this call needs. + initialization via _nl_find_msg. We have initialized + everything this call needs. + this is another thread which tried to initialize this object. Not necessary anymore since if the lock is available this @@ -1388,12 +1249,12 @@ _nl_load_domain (domain_file, domainbinding) goto out; } - /* Now initialize the character set converter from the character set - the file is encoded with (found in the header entry) to the domain's - specified character set or the locale's character set. */ - nullentry = _nl_init_domain_conv (domain_file, domain, domainbinding); + /* No caches of converted translations so far. */ + domain->conversions = NULL; + domain->nconversions = 0; - /* Also look for a plural specification. */ + /* Get the header entry and look for a plural specification. */ + nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen); EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals); out: @@ -1412,10 +1273,23 @@ internal_function __libc_freeres_fn_section _nl_unload_domain (domain) struct loaded_domain *domain; { + size_t i; + if (domain->plural != &__gettext_germanic_plural) __gettext_free_exp (domain->plural); - _nl_free_domain_conv (domain); + for (i = 0; i < domain->nconversions; i++) + { + struct converted_domain *convd = &domain->conversions[i]; + + free ((char *) convd->encoding); + if (convd->conv_tab != NULL && convd->conv_tab != (char **) -1) + free (convd->conv_tab); + if (convd->conv != (__gconv_t) -1) + __gconv_close (convd->conv); + } + if (domain->conversions != NULL) + free (domain->conversions); if (domain->malloced) free (domain->malloced); diff --git a/intl/locale.alias b/intl/locale.alias index 1a24c9e614..b43e79bbe5 100644 --- a/intl/locale.alias +++ b/intl/locale.alias @@ -58,8 +58,6 @@ korean ko_KR.eucKR korean.euc ko_KR.eucKR ko_KR ko_KR.eucKR lithuanian lt_LT.ISO-8859-13 -no_NO nb_NO.ISO-8859-1 -no_NO.ISO-8859-1 nb_NO.ISO-8859-1 norwegian nb_NO.ISO-8859-1 nynorsk nn_NO.ISO-8859-1 polish pl_PL.ISO-8859-2 diff --git a/intl/localealias.c b/intl/localealias.c index 32d05ff347..735107abd3 100644 --- a/intl/localealias.c +++ b/intl/localealias.c @@ -1,5 +1,5 @@ /* Handle aliases for locale names. - Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -295,7 +295,7 @@ read_alias_file (fname, fname_len) if (nmap >= maxmap) if (__builtin_expect (extend_alias_table (), 0)) - return added; + goto out; alias_len = strlen (alias) + 1; value_len = strlen (value) + 1; @@ -308,7 +308,7 @@ read_alias_file (fname, fname_len) ? alias_len + value_len : 1024)); char *new_pool = (char *) realloc (string_space, new_size); if (new_pool == NULL) - return added; + goto out; if (__builtin_expect (string_space != new_pool, 0)) { @@ -349,6 +349,7 @@ read_alias_file (fname, fname_len) while (strchr (buf, '\n') == NULL); } +out: /* Should we test for ferror()? I think we have to silently ignore errors. --drepper */ fclose (fp); diff --git a/intl/plural-exp.c b/intl/plural-exp.c index ba5d455cd5..9cb7a4540a 100644 --- a/intl/plural-exp.c +++ b/intl/plural-exp.c @@ -1,5 +1,5 @@ /* Expression parsing for plural form selection. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc. Written by Ulrich Drepper <drepper@cygnus.com>, 2000. This file is part of the GNU C Library. @@ -47,7 +47,7 @@ static const struct expression plone = .num = 1 } }; -struct expression GERMANIC_PLURAL = +const struct expression GERMANIC_PLURAL = { .nargs = 2, .operation = not_equal, diff --git a/intl/plural-exp.h b/intl/plural-exp.h index 75c702f79c..f8a5c87ff0 100644 --- a/intl/plural-exp.h +++ b/intl/plural-exp.h @@ -1,5 +1,5 @@ /* Expression parsing and evaluation for plural form selection. - Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2005 Free Software Foundation, Inc. Written by Ulrich Drepper <drepper@cygnus.com>, 2000. This file is part of the GNU C Library. @@ -113,7 +113,7 @@ struct parse_args extern void FREE_EXPRESSION PARAMS ((struct expression *exp)) internal_function; extern int PLURAL_PARSE PARAMS ((void *arg)); -extern struct expression GERMANIC_PLURAL attribute_hidden; +extern const struct expression GERMANIC_PLURAL attribute_hidden; extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry, struct expression **pluralp, unsigned long int *npluralsp)) diff --git a/intl/tst-codeset.sh b/intl/tst-codeset.sh index 3d9b9559b7..8b052168b2 100644 --- a/intl/tst-codeset.sh +++ b/intl/tst-codeset.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test of bind_textdomain_codeset. -# Copyright (C) 2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # @@ -26,12 +26,11 @@ LC_ALL=C export LC_ALL # Generate the test data. -test -d ${objpfx}domaindir || mkdir ${objpfx}domaindir +msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit # Create the domain directories. -test -d ${objpfx}domaindir/de_DE || mkdir ${objpfx}domaindir/de_DE -test -d ${objpfx}domaindir/de_DE/LC_MESSAGES || mkdir ${objpfx}domaindir/de_DE/LC_MESSAGES +mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES # Populate them. -msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo tstcodeset.po +mv -f ${objpfx}codeset.mo.$$ ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo GCONV_PATH=${common_objpfx}iconvdata export GCONV_PATH diff --git a/intl/tst-gettext2.sh b/intl/tst-gettext2.sh index 53f081a798..68157f8a68 100644 --- a/intl/tst-gettext2.sh +++ b/intl/tst-gettext2.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test of gettext functions. -# Copyright (C) 2000, 2003 Free Software Foundation, Inc. +# Copyright (C) 2000, 2003, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # @@ -26,7 +26,7 @@ LC_ALL=C export LC_ALL # Generate the test data. -test -d ${objpfx}domaindir || mkdir ${objpfx}domaindir +mkdir -p ${objpfx}domaindir # Create the locale directories. test -d ${objpfx}domaindir/lang1 || { mkdir ${objpfx}domaindir/lang1 diff --git a/intl/tst-gettext3.c b/intl/tst-gettext3.c new file mode 100644 index 0000000000..917967b383 --- /dev/null +++ b/intl/tst-gettext3.c @@ -0,0 +1,60 @@ +/* Test that the gettext() results come out in the correct encoding for + locales that differ only in their encoding. + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bruno Haible <bruno@clisp.org>, 2001, 2005. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <libintl.h> +#include <locale.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main (void) +{ + char *s; + int result = 0; + + unsetenv ("LANGUAGE"); + unsetenv ("OUTPUT_CHARSET"); + textdomain ("codeset"); + bindtextdomain ("codeset", OBJPFX "domaindir"); + + setlocale (LC_ALL, "de_DE.ISO-8859-1"); + + /* Here we expect output in ISO-8859-1. */ + s = gettext ("cheese"); + if (strcmp (s, "K\344se")) + { + printf ("call 1 returned: %s\n", s); + result = 1; + } + + setlocale (LC_ALL, "de_DE.UTF-8"); + + /* Here we expect output in UTF-8. */ + s = gettext ("cheese"); + if (strcmp (s, "K\303\244se")) + { + printf ("call 2 returned: %s\n", s); + result = 1; + } + + return result; +} diff --git a/intl/tst-gettext3.sh b/intl/tst-gettext3.sh new file mode 100644 index 0000000000..185576886e --- /dev/null +++ b/intl/tst-gettext3.sh @@ -0,0 +1,44 @@ +#! /bin/sh +# Test that the gettext() results come out in the correct encoding for +# locales that differ only in their encoding. +# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +common_objpfx=$1 +objpfx=$2 + +LC_ALL=C +export LC_ALL + +# Generate the test data. +msgfmt -o ${objpfx}codeset.mo.$$ tstcodeset.po || exit +# Create the domain directories. +mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES +# Populate them. +mv -f ${objpfx}codeset.mo.$$ ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo + +GCONV_PATH=${common_objpfx}iconvdata +export GCONV_PATH +LOCPATH=${common_objpfx}localedata +export LOCPATH + +${common_objpfx}elf/ld.so --library-path $common_objpfx \ +${objpfx}tst-gettext3 > ${objpfx}tst-gettext3.out + +exit $? diff --git a/intl/tst-gettext4-de.po b/intl/tst-gettext4-de.po new file mode 100644 index 0000000000..0a8d099398 --- /dev/null +++ b/intl/tst-gettext4-de.po @@ -0,0 +1,8 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +msgid "beauty" +msgstr "Schönheit" diff --git a/intl/tst-gettext4-fr.po b/intl/tst-gettext4-fr.po new file mode 100644 index 0000000000..8332c2d9f8 --- /dev/null +++ b/intl/tst-gettext4-fr.po @@ -0,0 +1,8 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8-bit\n" + +msgid "beauty" +msgstr "beauté" diff --git a/intl/tst-gettext4.c b/intl/tst-gettext4.c new file mode 100644 index 0000000000..a82446d14c --- /dev/null +++ b/intl/tst-gettext4.c @@ -0,0 +1,151 @@ +/* Test that gettext() in multithreaded applications works correctly if + different threads operate in different locales with the same encoding. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bruno Haible <bruno@clisp.org>, 2005. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <libintl.h> +#include <locale.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* Set to 1 if the program is not behaving correctly. */ +int result; + +/* Denotes which thread should run next. */ +int flipflop; +/* Lock and wait queue used to switch between the threads. */ +pthread_mutex_t lock; +pthread_cond_t waitqueue; + +/* Waits until the flipflop has a given value. + Before the call, the lock is unlocked. After the call, it is locked. */ +static void +waitfor (int value) +{ + if (pthread_mutex_lock (&lock)) + exit (10); + while (flipflop != value) + if (pthread_cond_wait (&waitqueue, &lock)) + exit (11); +} + +/* Sets the flipflop to a given value. + Before the call, the lock is locked. After the call, it is unlocked. */ +static void +setto (int value) +{ + flipflop = value; + if (pthread_cond_signal (&waitqueue)) + exit (20); + if (pthread_mutex_unlock (&lock)) + exit (21); +} + +void * +thread1_execution (void *arg) +{ + char *s; + + waitfor (1); + uselocale (newlocale (LC_ALL_MASK, "de_DE.ISO-8859-1", NULL)); + setto (2); + + waitfor (1); + s = gettext ("beauty"); + puts (s); + if (strcmp (s, "Sch\366nheit")) + { + fprintf (stderr, "thread 1 call 1 returned: %s\n", s); + result = 1; + } + setto (2); + + waitfor (1); + s = gettext ("beauty"); + puts (s); + if (strcmp (s, "Sch\366nheit")) + { + fprintf (stderr, "thread 1 call 2 returned: %s\n", s); + result = 1; + } + setto (2); + + return NULL; +} + +void * +thread2_execution (void *arg) +{ + char *s; + + waitfor (2); + uselocale (newlocale (LC_ALL_MASK, "fr_FR.ISO-8859-1", NULL)); + setto (1); + + waitfor (2); + s = gettext ("beauty"); + puts (s); + if (strcmp (s, "beaut\351")) + { + fprintf (stderr, "thread 2 call 1 returned: %s\n", s); + result = 1; + } + setto (1); + + waitfor (2); + s = gettext ("beauty"); + puts (s); + if (strcmp (s, "beaut\351")) + { + fprintf (stderr, "thread 2 call 2 returned: %s\n", s); + result = 1; + } + setto (1); + + return NULL; +} + +int +main (void) +{ + pthread_t thread1; + pthread_t thread2; + + unsetenv ("LANGUAGE"); + unsetenv ("OUTPUT_CHARSET"); + textdomain ("multithread"); + bindtextdomain ("multithread", OBJPFX "domaindir"); + result = 0; + + flipflop = 1; + if (pthread_mutex_init (&lock, NULL)) + exit (2); + if (pthread_cond_init (&waitqueue, NULL)) + exit (2); + if (pthread_create (&thread1, NULL, &thread1_execution, NULL)) + exit (2); + if (pthread_create (&thread2, NULL, &thread2_execution, NULL)) + exit (2); + if (pthread_join (thread2, NULL)) + exit (3); + + return result; +} diff --git a/intl/tst-gettext4.sh b/intl/tst-gettext4.sh new file mode 100755 index 0000000000..68779be04d --- /dev/null +++ b/intl/tst-gettext4.sh @@ -0,0 +1,44 @@ +#! /bin/sh +# Test that gettext() in multithreaded applications works correctly if +# different threads operate in different locales with the same encoding. +# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +common_objpfx=$1 +run_program_prefix=$2 +objpfx=$3 + +LC_ALL=C +export LC_ALL + +# Create the domain directories. +mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES +mkdir -p ${objpfx}domaindir/fr_FR/LC_MESSAGES +# Populate them. +msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/multithread.mo tst-gettext4-de.po +msgfmt -o ${objpfx}domaindir/fr_FR/LC_MESSAGES/multithread.mo tst-gettext4-fr.po + +GCONV_PATH=${common_objpfx}iconvdata +export GCONV_PATH +LOCPATH=${common_objpfx}localedata +export LOCPATH + +${run_program_prefix} ${objpfx}tst-gettext4 > ${objpfx}tst-gettext4.out + +exit $? diff --git a/intl/tst-gettext5.c b/intl/tst-gettext5.c new file mode 100644 index 0000000000..498ecab790 --- /dev/null +++ b/intl/tst-gettext5.c @@ -0,0 +1,156 @@ +/* Test that gettext() in multithreaded applications works correctly if + different threads operate in different locales referring to the same + catalog file but with different encodings. + Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bruno Haible <bruno@clisp.org>, 2005. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <libintl.h> +#include <locale.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* Set to 1 if the program is not behaving correctly. */ +int result; + +/* Denotes which thread should run next. */ +int flipflop; +/* Lock and wait queue used to switch between the threads. */ +pthread_mutex_t lock; +pthread_cond_t waitqueue; + +/* Waits until the flipflop has a given value. + Before the call, the lock is unlocked. After the call, it is locked. */ +static void +waitfor (int value) +{ + if (pthread_mutex_lock (&lock)) + exit (10); + while (flipflop != value) + if (pthread_cond_wait (&waitqueue, &lock)) + exit (11); +} + +/* Sets the flipflop to a given value. + Before the call, the lock is locked. After the call, it is unlocked. */ +static void +setto (int value) +{ + flipflop = value; + if (pthread_cond_signal (&waitqueue)) + exit (20); + if (pthread_mutex_unlock (&lock)) + exit (21); +} + +void * +thread1_execution (void *arg) +{ + char *s; + + waitfor (1); + uselocale (newlocale (LC_ALL_MASK, "de_DE.ISO-8859-1", NULL)); + setto (2); + + /* Here we expect output in ISO-8859-1. */ + + waitfor (1); + s = gettext ("cheese"); + puts (s); + if (strcmp (s, "K\344se")) + { + fprintf (stderr, "thread 1 call 1 returned: %s\n", s); + result = 1; + } + setto (2); + + waitfor (1); + s = gettext ("cheese"); + puts (s); + if (strcmp (s, "K\344se")) + { + fprintf (stderr, "thread 1 call 2 returned: %s\n", s); + result = 1; + } + setto (2); + + return NULL; +} + +void * +thread2_execution (void *arg) +{ + char *s; + + waitfor (2); + uselocale (newlocale (LC_ALL_MASK, "de_DE.UTF-8", NULL)); + setto (1); + + /* Here we expect output in UTF-8. */ + + waitfor (2); + s = gettext ("cheese"); + puts (s); + if (strcmp (s, "K\303\244se")) + { + fprintf (stderr, "thread 2 call 1 returned: %s\n", s); + result = 1; + } + setto (1); + + waitfor (2); + s = gettext ("cheese"); + puts (s); + if (strcmp (s, "K\303\244se")) + { + fprintf (stderr, "thread 2 call 2 returned: %s\n", s); + result = 1; + } + setto (1); + + return NULL; +} + +int +main (void) +{ + pthread_t thread1; + pthread_t thread2; + + unsetenv ("LANGUAGE"); + unsetenv ("OUTPUT_CHARSET"); + textdomain ("codeset"); + bindtextdomain ("codeset", OBJPFX "domaindir"); + result = 0; + + flipflop = 1; + if (pthread_mutex_init (&lock, NULL)) + exit (2); + if (pthread_cond_init (&waitqueue, NULL)) + exit (2); + if (pthread_create (&thread1, NULL, &thread1_execution, NULL)) + exit (2); + if (pthread_create (&thread2, NULL, &thread2_execution, NULL)) + exit (2); + if (pthread_join (thread2, NULL)) + exit (3); + + return result; +} diff --git a/intl/tst-gettext5.sh b/intl/tst-gettext5.sh new file mode 100755 index 0000000000..8c8d2170e4 --- /dev/null +++ b/intl/tst-gettext5.sh @@ -0,0 +1,43 @@ +#! /bin/sh +# Test that gettext() in multithreaded applications works correctly if +# different threads operate in different locales referring to the same +# catalog file but with different encodings. +# Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# + +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, write to the Free +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +# 02111-1307 USA. + +common_objpfx=$1 +run_program_prefix=$2 +objpfx=$3 + +LC_ALL=C +export LC_ALL + +# Create the domain directories. +mkdir -p ${objpfx}domaindir/de_DE/LC_MESSAGES +# Populate them. +msgfmt -o ${objpfx}domaindir/de_DE/LC_MESSAGES/codeset.mo tstcodeset.po + +GCONV_PATH=${common_objpfx}iconvdata +export GCONV_PATH +LOCPATH=${common_objpfx}localedata +export LOCPATH + +${run_program_prefix} ${objpfx}tst-gettext5 > ${objpfx}tst-gettext5.out + +exit $? diff --git a/intl/tst-translit.sh b/intl/tst-translit.sh index e2508df4df..22826e996c 100755 --- a/intl/tst-translit.sh +++ b/intl/tst-translit.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test of transliteration in gettext functions. -# Copyright (C) 2000, 2002 Free Software Foundation, Inc. +# Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. # This file is part of the GNU C Library. # @@ -25,6 +25,9 @@ objpfx=$2 LC_ALL=C export LC_ALL +# Create the locale directories. +mkdir -p ${objpfx}localedir/existing-locale/LC_MESSAGES + msgfmt -o ${objpfx}domaindir/existing-locale/LC_MESSAGES/translit.mo \ translit.po |