mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
Merge branch 'genums-cheri' into 'main'
genums: use g_once_init_enter_pointer for GType initializers See merge request GNOME/glib!3826
This commit is contained in:
commit
0eecb2b876
@ -320,14 +320,14 @@ void g_flags_complete_type_info (GType g_flags_type,
|
||||
#define G_DEFINE_ENUM_TYPE(TypeName, type_name, ...) \
|
||||
GType \
|
||||
type_name ## _get_type (void) { \
|
||||
static gsize g_define_type__static = 0; \
|
||||
if (g_once_init_enter (&g_define_type__static)) { \
|
||||
static _g_type_once_init_type g_define_type__static = 0; \
|
||||
if (_g_type_once_init_enter (&g_define_type__static)) { \
|
||||
static const GEnumValue enum_values[] = { \
|
||||
__VA_ARGS__ , \
|
||||
{ 0, NULL, NULL }, \
|
||||
}; \
|
||||
GType g_define_type = g_enum_register_static (g_intern_static_string (#TypeName), enum_values); \
|
||||
g_once_init_leave (&g_define_type__static, g_define_type); \
|
||||
_g_type_once_init_leave (&g_define_type__static, g_define_type); \
|
||||
} \
|
||||
return g_define_type__static; \
|
||||
} \
|
||||
@ -363,14 +363,14 @@ type_name ## _get_type (void) { \
|
||||
#define G_DEFINE_FLAGS_TYPE(TypeName, type_name, ...) \
|
||||
GType \
|
||||
type_name ## _get_type (void) { \
|
||||
static gsize g_define_type__static = 0; \
|
||||
if (g_once_init_enter (&g_define_type__static)) { \
|
||||
static _g_type_once_init_type g_define_type__static = 0; \
|
||||
if (_g_type_once_init_enter (&g_define_type__static)) { \
|
||||
static const GFlagsValue flags_values[] = { \
|
||||
__VA_ARGS__ , \
|
||||
{ 0, NULL, NULL }, \
|
||||
}; \
|
||||
GType g_define_type = g_flags_register_static (g_intern_static_string (#TypeName), flags_values); \
|
||||
g_once_init_leave (&g_define_type__static, g_define_type); \
|
||||
_g_type_once_init_leave (&g_define_type__static, g_define_type); \
|
||||
} \
|
||||
return g_define_type__static; \
|
||||
} \
|
||||
|
Loading…
Reference in New Issue
Block a user