libnm-core,libnm-util: avoid calling a constructor

It yields completely unpredictable results on Ubuntu 12.04 (the global variable
successfully comparing to NULL despite demonstrably not NULL). Possibly a
toolchain bug.
This commit is contained in:
Lubomir Rintel 2015-05-15 18:27:19 +02:00
parent 3811a68389
commit ccb0ca4493
2 changed files with 14 additions and 2 deletions

View file

@ -91,7 +91,7 @@ _nm_gtype_hash (gconstpointer v)
return *((const GType *) v);
}
static void __attribute__((constructor))
static void
_ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
@ -103,6 +103,12 @@ _ensure_registered (void)
}
}
static void __attribute__((constructor))
_ensure_registered_constructor (void)
{
_ensure_registered ();
}
#define _ensure_setting_info(self, priv) \
G_STMT_START { \
NMSettingPrivate *_priv_esi = (priv); \

View file

@ -99,7 +99,7 @@ _nm_gtype_hash (gconstpointer v)
return *((const GType *) v);
}
static void __attribute__((constructor))
static void
_ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
@ -112,6 +112,12 @@ _ensure_registered (void)
}
}
static void __attribute__((constructor))
_ensure_registered_constructor (void)
{
_ensure_registered ();
}
#define _ensure_setting_info(self, priv) \
G_STMT_START { \
NMSettingPrivate *_priv_esi = (priv); \