mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-15 12:08:04 +02:00
Sat Dec 14 20:11:41 2002 Owen Taylor <otaylor@redhat.com> * glib/libcharset/{localcharset.[ch] libcharset-glib.patch} glib/gutf8.c: Break _g_locale_charset() into two pieces - a fast "raw" piece, and a slow "unalias pieces". Always call the "raw" piece, and call the unalias bit if it changes. Use a per-thread cache. (#79529)
95 lines
2.8 KiB
Diff
95 lines
2.8 KiB
Diff
diff -ur libcharset/localcharset.c /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/localcharset.c
|
|
--- libcharset/localcharset.c Sat Dec 14 20:04:44 2002
|
|
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/localcharset.c Sat Dec 14 20:09:45 2002
|
|
@@ -102,8 +102,8 @@
|
|
static const char * volatile charset_aliases;
|
|
|
|
/* Return a pointer to the contents of the charset.alias file. */
|
|
-static const char *
|
|
-get_charset_aliases ()
|
|
+const char *
|
|
+_g_locale_get_charset_aliases ()
|
|
{
|
|
const char *cp;
|
|
|
|
@@ -235,14 +235,10 @@
|
|
If the canonical name cannot be determined, the result is a non-canonical
|
|
name. */
|
|
|
|
-#ifdef STATIC
|
|
-STATIC
|
|
-#endif
|
|
const char *
|
|
-locale_charset ()
|
|
+_g_locale_charset_raw ()
|
|
{
|
|
const char *codeset;
|
|
- const char *aliases;
|
|
|
|
#if !(defined WIN32 || defined OS2)
|
|
|
|
@@ -344,12 +340,23 @@
|
|
|
|
#endif
|
|
|
|
+ return codeset;
|
|
+}
|
|
+
|
|
+#ifdef STATIC
|
|
+STATIC
|
|
+#endif
|
|
+const char *
|
|
+_g_locale_charset_unalias (const char *codeset)
|
|
+{
|
|
+ const char *aliases;
|
|
+
|
|
if (codeset == NULL)
|
|
/* The canonical name cannot be determined. */
|
|
codeset = "";
|
|
|
|
/* Resolve alias. */
|
|
- for (aliases = get_charset_aliases ();
|
|
+ for (aliases = _g_locale_get_charset_aliases ();
|
|
*aliases != '\0';
|
|
aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)
|
|
if (strcmp (codeset, aliases) == 0
|
|
diff -ur libcharset/glibc21.m4 /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/glibc21.m4
|
|
--- libcharset/glibc21.m4 Sat Dec 14 20:04:44 2002
|
|
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/glibc21.m4 Fri Sep 28 19:44:46 2001
|
|
@@ -3,7 +3,7 @@
|
|
# Test for the GNU C Library, version 2.1 or newer.
|
|
# From Bruno Haible.
|
|
|
|
-AC_DEFUN(jm_GLIBC21,
|
|
+AC_DEFUN([jm_GLIBC21],
|
|
[
|
|
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
|
|
ac_cv_gnu_library_2_1,
|
|
diff -ur libcharset/codeset.m4 /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/codeset.m4
|
|
--- libcharset/codeset.m4 Sat Dec 14 20:04:44 2002
|
|
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/codeset.m4 Fri Sep 28 19:44:46 2001
|
|
@@ -2,7 +2,7 @@
|
|
|
|
dnl From Bruno Haible.
|
|
|
|
-AC_DEFUN(jm_LANGINFO_CODESET,
|
|
+AC_DEFUN([jm_LANGINFO_CODESET],
|
|
[
|
|
AC_CHECK_HEADERS(langinfo.h)
|
|
AC_CHECK_FUNCS(nl_langinfo)
|
|
diff -ur libcharset/libcharset.h /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/libcharset.h
|
|
--- libcharset/libcharset.h Sat Dec 14 20:04:44 2002
|
|
+++ /home/otaylor/cvs/gnome2/glib-head/glib/libcharset/libcharset.h Sat Dec 14 19:03:11 2002
|
|
@@ -30,8 +30,9 @@
|
|
The result must not be freed; it is statically allocated.
|
|
If the canonical name cannot be determined, the result is a non-canonical
|
|
name. */
|
|
-extern const char * locale_charset (void);
|
|
-
|
|
+extern const char * _g_locale_charset_raw (void);
|
|
+extern const char * _g_locale_charset_unalias (const char *codeset);
|
|
+extern const char * _g_locale_get_charset_aliases (void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|