[glib] Move _glib_get_locale_dir to ggettext.c



commit f3ac581713f7297b0bf33c77c47e9bf32961775f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Oct 18 00:15:37 2011 +0800

    Move _glib_get_locale_dir to ggettext.c
    
    -Move _glib_get_locale_dir to ggettext.c, as Matthias suggested
    -Made up for the headers that needed to be included in ggettext.c to avoid
     C4013 (implicit declaration of ...) errors/warnings

 glib/ggettext.c |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 glib/gutils.c   |   50 -------------------------------------------------
 2 files changed, 56 insertions(+), 50 deletions(-)
---
diff --git a/glib/ggettext.c b/glib/ggettext.c
index 58f74d2..d7054fc 100644
--- a/glib/ggettext.c
+++ b/glib/ggettext.c
@@ -30,11 +30,67 @@
 
 #include "galloca.h"
 #include "gthread.h"
+#include "gmem.h"
+#ifdef G_OS_WIN32
+#include "gwin32.h"
+#include "gfileutils.h"
+#include "gstrfuncs.h"
+#include "glib-init.h"
+#endif
 
 #include <string.h>
 #include <locale.h>
 #include <libintl.h>
 
+#ifdef G_OS_WIN32
+
+/**
+ * _glib_get_locale_dir:
+ *
+ * Return the path to the share\locale or lib\locale subfolder of the
+ * GLib installation folder. The path is in the system codepage. We
+ * have to use system codepage as bindtextdomain() doesn't have a
+ * UTF-8 interface.
+ */
+gchar *
+_glib_get_locale_dir (void)
+{
+  gchar *install_dir = NULL, *locale_dir;
+  gchar *retval = NULL;
+
+  if (glib_dll != NULL)
+    install_dir = g_win32_get_package_installation_directory_of_module (glib_dll);
+
+  if (install_dir)
+    {
+      /*
+       * Append "/share/locale" or "/lib/locale" depending on whether
+       * autoconfigury detected GNU gettext or not.
+       */
+      const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR);
+      while (*--p != '/')
+	;
+      while (*--p != '/')
+	;
+
+      locale_dir = g_build_filename (install_dir, p, NULL);
+
+      retval = g_win32_locale_filename_from_utf8 (locale_dir);
+
+      g_free (install_dir);
+      g_free (locale_dir);
+    }
+
+  if (retval)
+    return retval;
+  else
+    return g_strdup ("");
+}
+
+#undef GLIB_LOCALE_DIR
+
+#endif /* G_OS_WIN32 */
+
 
 static void
 ensure_gettext_initialized (void)
diff --git a/glib/gutils.c b/glib/gutils.c
index 63fb5ce..934452d 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -2330,56 +2330,6 @@ g_format_size_for_display (goffset size)
     }
 }
 
-#ifdef G_OS_WIN32
-
-/**
- * _glib_get_locale_dir:
- *
- * Return the path to the share\locale or lib\locale subfolder of the
- * GLib installation folder. The path is in the system codepage. We
- * have to use system codepage as bindtextdomain() doesn't have a
- * UTF-8 interface.
- */
-gchar *
-_glib_get_locale_dir (void)
-{
-  gchar *install_dir = NULL, *locale_dir;
-  gchar *retval = NULL;
-
-  if (glib_dll != NULL)
-    install_dir = g_win32_get_package_installation_directory_of_module (glib_dll);
-
-  if (install_dir)
-    {
-      /*
-       * Append "/share/locale" or "/lib/locale" depending on whether
-       * autoconfigury detected GNU gettext or not.
-       */
-      const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR);
-      while (*--p != '/')
-	;
-      while (*--p != '/')
-	;
-
-      locale_dir = g_build_filename (install_dir, p, NULL);
-
-      retval = g_win32_locale_filename_from_utf8 (locale_dir);
-
-      g_free (install_dir);
-      g_free (locale_dir);
-    }
-
-  if (retval)
-    return retval;
-  else
-    return g_strdup ("");
-}
-
-#undef GLIB_LOCALE_DIR
-
-#endif /* G_OS_WIN32 */
-
-
 #if defined (G_OS_WIN32) && !defined (_WIN64)
 
 /* Binary compatibility versions. Not for newly compiled code. */



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