[glib] Use G_DEFINE_CONSTRUCTOR for the glib_init constructor



commit 3cf1ad1881c2d8f0cac67d51d3e29713bb28a201
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Mar 5 15:05:07 2012 +0100

    Use G_DEFINE_CONSTRUCTOR for the glib_init constructor
    
    No need to hand-roll this when we have a macro version.

 glib/glib-init.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/glib/glib-init.c b/glib/glib-init.c
index 5442a97..d5e8242 100644
--- a/glib/glib-init.c
+++ b/glib/glib-init.c
@@ -24,6 +24,7 @@
 #include "glib-init.h"
 
 #include "gutils.h"     /* for GDebugKey */
+#include "gconstructor.h"
 
 #include <string.h>
 #include <stdlib.h>
@@ -246,9 +247,14 @@ DllMain (HINSTANCE hinstDLL,
   return TRUE;
 }
 
-#elif defined (__GNUC__)
+#elif defined (G_HAS_CONSTRUCTORS)
 
-__attribute__ ((constructor)) static void
+#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
+#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(glib_init_ctor)
+#endif
+G_DEFINE_CONSTRUCTOR(glib_init_ctor)
+
+static void
 glib_init_ctor (void)
 {
   glib_init ();



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