Use G_DEFINE_CONSTRUCTOR for the glib_init constructor
authorAlexander Larsson <alexl@redhat.com>
Mon, 5 Mar 2012 14:05:07 +0000 (15:05 +0100)
committerAlexander Larsson <alexl@redhat.com>
Mon, 5 Mar 2012 14:06:22 +0000 (15:06 +0100)
No need to hand-roll this when we have a macro version.

glib/glib-init.c

index 5442a97..d5e8242 100644 (file)
@@ -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 ();