mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 09:46:17 +01:00
end the glib-ctor experiment
This was a bad approach. We attempt to handle initailisation in a more centralised way now.
This commit is contained in:
parent
bb5d90a768
commit
e3be556728
@ -149,7 +149,6 @@ libglib_2_0_la_SOURCES = \
|
|||||||
gkeyfile.c \
|
gkeyfile.c \
|
||||||
glibintl.h \
|
glibintl.h \
|
||||||
glib_trace.h \
|
glib_trace.h \
|
||||||
glib-ctor.h \
|
|
||||||
glib-init.h \
|
glib-init.h \
|
||||||
glib-init.c \
|
glib-init.c \
|
||||||
glib-private.h \
|
glib-private.h \
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
#ifndef __GLIB_CTOR_H__
|
|
||||||
|
|
||||||
#if defined (__GNUC__) && !defined (_WIN32)
|
|
||||||
#define GLIB_CTOR(func) \
|
|
||||||
__attribute__((constructor)) static void func (void)
|
|
||||||
#define GLIB_ENSURE_CTOR(func) G_STMT_START { } G_STMT_END
|
|
||||||
#else
|
|
||||||
/* could be vastly improved... */
|
|
||||||
#define GLIB_CTOR(func) \
|
|
||||||
static GMutex g__##func##_mutex; \
|
|
||||||
static gboolean g__##func##_initialised; \
|
|
||||||
static void func (void)
|
|
||||||
#define GLIB_ENSURE_CTOR(func) \
|
|
||||||
G_STMT_START { \
|
|
||||||
g_mutex_lock (&g__##func##_mutex); \
|
|
||||||
if (!g__##func##_initialised) \
|
|
||||||
{ \
|
|
||||||
g__##func##_initialised = TRUE; \
|
|
||||||
func (); \
|
|
||||||
} \
|
|
||||||
g_mutex_unlock (&g__##func##_mutex); \
|
|
||||||
} G_STMT_END
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __GLIB_CTOR_H__ */
|
|
@ -43,8 +43,6 @@
|
|||||||
#include "gtestutils.h"
|
#include "gtestutils.h"
|
||||||
#include "gthread.h"
|
#include "gthread.h"
|
||||||
#include "glib_trace.h"
|
#include "glib_trace.h"
|
||||||
#include "glib-ctor.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define MEM_PROFILE_TABLE_SIZE 4096
|
#define MEM_PROFILE_TABLE_SIZE 4096
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user