[glib] Move G_DIR_SEPARATOR* and G_SEARCHPATH_SEPARATOR* into glibconfig.h



commit 6dafc1ce1387a03cd453ff4e42b6acd9ce461e68
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date:   Thu Oct 29 08:53:00 2015 +0200

    Move G_DIR_SEPARATOR* and G_SEARCHPATH_SEPARATOR* into glibconfig.h
    
    As platform-dependent macros, they belong in glibconfig.h.
    This also makes it one less place where g-ir-scanner picks definitions
    from the wrong ifdef branch; see
    https://bugzilla.gnome.org/show_bug.cgi?id=696935
    
    Meson configuration support is also added in this commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757284

 configure.ac               |   12 ++++++++++++
 glib/gfileutils.h          |    9 +--------
 glib/glibconfig.h.in       |    5 +++++
 glib/glibconfig.h.win32.in |    5 +++++
 meson.build                |    4 ++++
 5 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b28dbfb..ec20660 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,6 +127,8 @@ case "$host" in
     glib_pid_type='void *'
     glib_pid_format='p'
     glib_pollfd_format='%#x'
+    glib_dir_separator='\\'
+    glib_searchpath_separator=';'
     glib_cv_stack_grows=no
     # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
     # don't seem to be quite good enough, at least not in mingw-runtime-3.14.
@@ -151,6 +153,8 @@ case "$host" in
     glib_pid_type=int
     glib_pid_format='i'
     glib_pollfd_format='%d'
+    glib_dir_separator='/'
+    glib_searchpath_separator=':'
     ;;
 esac
 case $host in
@@ -2945,6 +2949,11 @@ typedef $g_pid_type GPid;
 #define GLIB_SYSDEF_MSG_PEEK $g_msg_peek
 #define GLIB_SYSDEF_MSG_DONTROUTE $g_msg_dontroute
 
+#define G_DIR_SEPARATOR '$g_dir_separator'
+#define G_DIR_SEPARATOR_S "$g_dir_separator"
+#define G_SEARCHPATH_SEPARATOR '$g_searchpath_separator'
+#define G_SEARCHPATH_SEPARATOR_S "$g_searchpath_separator"
+
 G_END_DECLS
 
 #endif /* __GLIBCONFIG_H__ */
@@ -3217,6 +3226,9 @@ g_memory_barrier_needed="$glib_memory_barrier_needed"
 g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations"
 
 g_module_suffix="$glib_gmodule_suffix"
+g_dir_separator="$glib_dir_separator"
+g_searchpath_separator="$glib_searchpath_separator"
+
 g_pid_type="$glib_pid_type"
 g_pid_format="\"$glib_pid_format\""
 g_pollfd_format="\"$glib_pollfd_format\""
diff --git a/glib/gfileutils.h b/glib/gfileutils.h
index 4b4b1f9..b24651e 100644
--- a/glib/gfileutils.h
+++ b/glib/gfileutils.h
@@ -23,6 +23,7 @@
 #error "Only <glib.h> can be included directly."
 #endif
 
+#include <glibconfig.h>
 #include <glib/gerror.h>
 
 G_BEGIN_DECLS
@@ -145,19 +146,11 @@ gint     g_mkdir_with_parents (const gchar *pathname,
  * the search path separator is the semicolon. Note that also the
  * (forward) slash works as directory separator.
  */
-#define G_DIR_SEPARATOR '\\'
-#define G_DIR_SEPARATOR_S "\\"
 #define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR || (c) == '/')
-#define G_SEARCHPATH_SEPARATOR ';'
-#define G_SEARCHPATH_SEPARATOR_S ";"
 
 #else  /* !G_OS_WIN32 */
 
-#define G_DIR_SEPARATOR '/'
-#define G_DIR_SEPARATOR_S "/"
 #define G_IS_DIR_SEPARATOR(c) ((c) == G_DIR_SEPARATOR)
-#define G_SEARCHPATH_SEPARATOR ':'
-#define G_SEARCHPATH_SEPARATOR_S ":"
 
 #endif /* !G_OS_WIN32 */
 
diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in
index 076d7ac..fb456a9 100644
--- a/glib/glibconfig.h.in
+++ b/glib/glibconfig.h.in
@@ -204,6 +204,11 @@ typedef @g_pid_type@ GPid;
 #define GLIB_SYSDEF_MSG_PEEK @g_msg_peek@
 #define GLIB_SYSDEF_MSG_DONTROUTE @g_msg_dontroute@
 
+#define G_DIR_SEPARATOR '@g_dir_separator@'
+#define G_DIR_SEPARATOR_S "@g_dir_separator@"
+#define G_SEARCHPATH_SEPARATOR '@g_searchpath_separator@'
+#define G_SEARCHPATH_SEPARATOR_S "@g_searchpath_separator@"
+
 G_END_DECLS
 
 #endif /* __GLIBCONFIG_H__ */
diff --git a/glib/glibconfig.h.win32.in b/glib/glibconfig.h.win32.in
index d16e7c8..b8214c0 100644
--- a/glib/glibconfig.h.win32.in
+++ b/glib/glibconfig.h.win32.in
@@ -252,6 +252,11 @@ typedef void * GPid;
 #define GLIB_SYSDEF_MSG_PEEK      2
 #define GLIB_SYSDEF_MSG_DONTROUTE 4
 
+#define G_DIR_SEPARATOR '\\'
+#define G_DIR_SEPARATOR_S "\\"
+#define G_SEARCHPATH_SEPARATOR ';'
+#define G_SEARCHPATH_SEPARATOR_S ";"
+
 G_END_DECLS
 
 #endif /* GLIBCONFIG_H */
diff --git a/meson.build b/meson.build
index e35b54d..4f14791 100644
--- a/meson.build
+++ b/meson.build
@@ -997,10 +997,14 @@ if host_system == 'windows'
   else
     glibconfig_conf.set_quoted('g_pollfd_format', '%#x')
   endif
+  glibconfig_conf.set('g_dir_separator', '\\')
+  glibconfig_conf.set('g_searchpath_separator', ';')
 else
   glibconfig_conf.set('g_pid_type', 'int')
   glibconfig_conf.set_quoted('g_pid_format', 'i')
   glibconfig_conf.set_quoted('g_pollfd_format', '%d')
+  glibconfig_conf.set('g_dir_separator', '/')
+  glibconfig_conf.set('g_searchpath_separator', ':')
 endif
 
 if sizet_size == short_size


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