aboutsummaryrefslogtreecommitdiff
path: root/intl/gettextP.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-04-04 22:37:38 +0000
committerUlrich Drepper <drepper@redhat.com>2005-04-04 22:37:38 +0000
commit4e82c610255f6a186c20c73e74f8e71dcda98efc (patch)
treeb55a3e6692a0261c576330950793bde88524e0e1 /intl/gettextP.h
parent7a50b1f6d1bd959ae5dfb5539d9cd8935eb8d926 (diff)
downloadglibc-4e82c610255f6a186c20c73e74f8e71dcda98efc.zip
glibc-4e82c610255f6a186c20c73e74f8e71dcda98efc.tar.gz
glibc-4e82c610255f6a186c20c73e74f8e71dcda98efc.tar.bz2
* intl/tst-gettext3.c: New file.
* intl/tst-gettext3.sh: New file. * intl/Makefile (distribute): Add tst-gettext3.sh. (test-srcs): Add tst-gettext3. (tests): Depend on tst-gettext3.out. (tst-gettext3.out): New rule. (CFLAGS-tst-gettext3.c): New variable. Fix bug exposed by tst-gettext3. * intl/gettextP.h (struct converted_domain): New type. (struct loaded_domain): Remove the conv, conv_tab fields. Add conversions, nconversions fields. (_nl_init_domain_conv): Remove declaration. (_nl_free_domain_conv): Remove declaration. (_nl_find_msg): Add convert argument. * intl/dcigettext.c (DCIGETTEXT): Call _nl_find_msg with convert=1. (_nl_find_msg): Add convert argument. When a conversion to a different charset is needed, create a new converted_domain element, instead of throwing away the old converted translations. (get_output_charset): New function. * intl/loadmsgcat.c (_nl_init_domain_conv): Remove function. (_nl_free_domain_conv): Remove function. (_nl_load_domain): Initialize the conversions array to empty. Use _nl_find_msg instead of _nl_init_domain_conv to retrieve the header entry. (_nl_unload_domain): Free the conversions array and its contents. * intl/gettextP.h (struct loaded_domain): Remove codeset_cntr field. (struct binding): Likewise. * intl/bindtextdom.c (set_binding_values): Drop codeset_cntr modifications.
Diffstat (limited to 'intl/gettextP.h')
-rw-r--r--intl/gettextP.h45
1 files changed, 26 insertions, 19 deletions
diff --git a/intl/gettextP.h b/intl/gettextP.h
index 46b51e1..f18535a 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