[glib/glib-2-26] Bug635093: Moved/Added macro checks for MSVC build



commit 0dc7ae3b1a8e535c2bcc22c7c9f453590f1eb508
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Nov 30 10:15:10 2010 +0800

    Bug635093: Moved/Added macro checks for MSVC build
    
    -glib/gtimer.c: some compilers do not have <sys/time.h>,
     so check for that from config.h(.win32)
    -glib/gdatetime.c, glib/gmessages.c, glib/gscanner.c:
     move G_OS_WIN32 check after GLib header includes so
     that they can be checked correctly on MSVC too.

 glib/gdatetime.c |   10 +++++-----
 glib/gmessages.c |   18 +++++++++---------
 glib/gscanner.c  |    8 ++++----
 glib/gtimer.c    |    2 ++
 4 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/glib/gdatetime.c b/glib/gdatetime.c
index 3509cec..73a2a4a 100644
--- a/glib/gdatetime.c
+++ b/glib/gdatetime.c
@@ -54,11 +54,6 @@
 #include <unistd.h>
 #endif
 
-#ifndef G_OS_WIN32
-#include <sys/time.h>
-#include <time.h>
-#endif /* !G_OS_WIN32 */
-
 #include "gdatetime.h"
 
 #include "gatomic.h"
@@ -71,6 +66,11 @@
 #include "gthread.h"
 #include "gtimezoneprivate.h"
 
+#ifndef G_OS_WIN32
+#include <sys/time.h>
+#include <time.h>
+#endif /* !G_OS_WIN32 */
+
 #include "glibintl.h"
 
 /**
diff --git a/glib/gmessages.c b/glib/gmessages.c
index f9592ba..245e454 100644
--- a/glib/gmessages.c
+++ b/glib/gmessages.c
@@ -41,15 +41,6 @@
 #include <locale.h>
 #include <errno.h>
 
-#ifdef G_OS_WIN32
-#include <process.h>		/* For getpid() */
-#include <io.h>
-#  define STRICT		/* Strict typing, please */
-#  define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
-#  include <windows.h>
-#  undef STRICT
-#endif
-
 #include "gmessages.h"
 
 #include "gbacktrace.h"
@@ -63,6 +54,15 @@
 #include "gstrfuncs.h"
 #include "gstring.h"
 
+#ifdef G_OS_WIN32
+#include <process.h>		/* For getpid() */
+#include <io.h>
+#  define STRICT		/* Strict typing, please */
+#  define _WIN32_WINDOWS 0x0401 /* to get IsDebuggerPresent */
+#  include <windows.h>
+#  undef STRICT
+#endif
+
 
 /* --- structures --- */
 typedef struct _GLogDomain	GLogDomain;
diff --git a/glib/gscanner.c b/glib/gscanner.c
index 1234a60..7dc2eb3 100644
--- a/glib/gscanner.c
+++ b/glib/gscanner.c
@@ -42,10 +42,6 @@
 #include <unistd.h>
 #endif
 
-#ifdef G_OS_WIN32
-#include <io.h> /* For _read() */
-#endif
-
 #include "gscanner.h"
 
 #include "gprintfint.h"
@@ -53,6 +49,10 @@
 #include "gstring.h"
 #include "gtestutils.h"
 
+#ifdef G_OS_WIN32
+#include <io.h> /* For _read() */
+#endif
+
 /* --- defines --- */
 #define	to_lower(c)				( \
 	(guchar) (							\
diff --git a/glib/gtimer.c b/glib/gtimer.c
index bc5b54c..8716c6d 100644
--- a/glib/gtimer.c
+++ b/glib/gtimer.c
@@ -37,7 +37,9 @@
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
+#ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
+#endif
 #include <time.h>
 #ifndef G_OS_WIN32
 #include <errno.h>



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