[gnome-games] libgames-support: Add another glib compat define



commit 5a06a8dacaa041908bc76e4c66a9c2a2e5e3d766
Author: Christian Persch <chpe gnome org>
Date:   Mon Jan 4 20:06:17 2010 +0100

    libgames-support: Add another glib compat define

 libgames-support/games-card.h        |    4 +++-
 libgames-support/games-glib-compat.h |    9 +++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/libgames-support/games-card.h b/libgames-support/games-card.h
index 0300359..3f34653 100644
--- a/libgames-support/games-card.h
+++ b/libgames-support/games-card.h
@@ -25,6 +25,8 @@
 
 #include <glib.h>
 
+#include "games-glib-compat.h"
+
 G_BEGIN_DECLS
 
 /* __attribute__((__packed__)) is needed on some archs to make
@@ -52,7 +54,7 @@ typedef union {
 } GNOME_GAMES_GNUC_PACKED Card;
 
 #ifndef __GI_SCANNER__
-typedef int _games_card_size_assert[sizeof (Card) == sizeof (guint8) ? 1 : -1]; /* static assertion */
+G_STATIC_ASSERT(sizeof (Card) == sizeof (guint8));
 #endif
 
 #define CARD(c)               ((Card) c)
diff --git a/libgames-support/games-glib-compat.h b/libgames-support/games-glib-compat.h
index 0eef546..9cf3205 100644
--- a/libgames-support/games-glib-compat.h
+++ b/libgames-support/games-glib-compat.h
@@ -41,8 +41,17 @@ G_BEGIN_DECLS
 
 #define g_timeout_add_seconds(timeout,callback,data) g_timeout_add ((timeout)*1000, callback, data)
 #define gdk_threads_add_timeout_seconds(timeout,callback,data) g_timeout_add ((timeout)*1000, callback, data)
+
 #endif /* GLIB < 2.14 */
 
+#if !GLIB_CHECK_VERSION (2, 20, 0)
+
+#define G_PASTE_ARGS(identifier1,identifier2) identifier1 ## identifier2
+#define G_PASTE(identifier1,identifier2)      G_PASTE_ARGS (identifier1, identifier2)
+#define G_STATIC_ASSERT(expr) typedef struct { char Compile_Time_Assertion[(expr) ? 1 : -1]; } G_PASTE (_GStaticAssert_, __LINE__)
+
+#endif /* GLIB < 2.20 */
+
 G_END_DECLS
 
 #endif /* !GAMES_GLIB_COMPAT_H */



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