[glib] Move g_get_codeset next to g_get_charset



commit d0bb1e0b0a3237f982a0ec234e7be877d4e223f2
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 15 23:27:28 2011 -0400

    Move g_get_codeset next to g_get_charset
    
    g_get_codeset is a close relatove to g_get_charset, and up to now
    it lived a shadowy existence without any header presence.

 docs/reference/glib/glib-sections.txt |    1 +
 glib/gunicode.h                       |   11 +++--------
 glib/gutf8.c                          |   28 +++++++++++++++++++++++-----
 glib/gutils.c                         |   18 ------------------
 4 files changed, 27 insertions(+), 31 deletions(-)
---
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index d20a65b..9fbabaf 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -2666,6 +2666,7 @@ GConvertError
 
 <SUBSECTION>
 g_get_charset
+g_get_codeset
 
 <SUBSECTION Private>
 g_convert_error_quark
diff --git a/glib/gunicode.h b/glib/gunicode.h
index 15b3a95..2090bff 100644
--- a/glib/gunicode.h
+++ b/glib/gunicode.h
@@ -486,16 +486,11 @@ typedef enum
   G_UNICODE_SCRIPT_MANDAIC                 /* Mand */
 } GUnicodeScript;
 
-guint32 g_unicode_script_to_iso15924 (GUnicodeScript script);
-GUnicodeScript g_unicode_script_from_iso15924 (guint32 iso15924);
-
-/* Returns TRUE if current locale uses UTF-8 charset.  If CHARSET is
- * not null, sets *CHARSET to the name of the current locale's
- * charset.  This value is statically allocated, and should be copied
- * in case the locale's charset will be changed later using setlocale()
- * or in some other way.
- */
+guint32        g_unicode_script_to_iso15924   (GUnicodeScript script);
+GUnicodeScript g_unicode_script_from_iso15924 (guint32        iso15924);
+
 gboolean g_get_charset (const char **charset);
+gchar *  g_get_codeset (void);
 
 /* These are all analogs of the <ctype.h> functions.
  */
diff --git a/glib/gutf8.c b/glib/gutf8.c
index 3558c20..dfca145 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -563,7 +563,7 @@ charset_cache_free (gpointer data)
 /**
  * g_get_charset:
  * @charset: return location for character set name
- * 
+ *
  * Obtains the character set for the <link linkend="setlocale">current 
  * locale</link>; you might use this character set as an argument to 
  * g_convert(), to convert from the current locale's encoding to some 
@@ -583,7 +583,7 @@ charset_cache_free (gpointer data)
  * freed.
  *
  * Return value: %TRUE if the returned charset is UTF-8
- **/
+ */
 gboolean
 g_get_charset (const char **charset)
 {
@@ -600,11 +600,11 @@ g_get_charset (const char **charset)
   G_LOCK (aliases);
   raw = _g_locale_charset_raw ();
   G_UNLOCK (aliases);
-  
+
   if (!(cache->raw && strcmp (cache->raw, raw) == 0))
     {
       const gchar *new_charset;
-	    
+
       g_free (cache->raw);
       g_free (cache->charset);
       cache->raw = g_strdup (raw);
@@ -614,10 +614,28 @@ g_get_charset (const char **charset)
 
   if (charset)
     *charset = cache->charset;
-  
+
   return cache->is_utf8;
 }
 
+/**
+ * g_get_codeset:
+ *
+ * Gets the character set for the current locale.
+ *
+ * Return value: a newly allocated string containing the name
+ *     of the character set. This string must be freed with g_free().
+ */
+gchar *
+g_get_codeset (void)
+{
+  const gchar *charset;
+
+  g_get_charset (&charset);
+
+  return g_strdup (charset);
+}
+
 /* unicode_strchr */
 
 /**
diff --git a/glib/gutils.c b/glib/gutils.c
index a3bcde5..1a69973 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2955,24 +2955,6 @@ g_nullify_pointer (gpointer *nullify_location)
   *nullify_location = NULL;
 }
 
-/**
- * g_get_codeset:
- *
- * Get the codeset for the current locale.
- *
- * Return value: a newly allocated string containing the name
- * of the codeset. This string must be freed with g_free().
- **/
-gchar *
-g_get_codeset (void)
-{
-  const gchar *charset;
-
-  g_get_charset (&charset);
-
-  return g_strdup (charset);
-}
-
 #ifdef G_OS_WIN32
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]