summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-07-10 10:41:31 +0200
committerThomas Haller <thaller@redhat.com>2015-07-12 13:56:52 +0200
commit904e9614641fe8203a5f61abaa841b7d186a343b (patch)
tree110e2f0004e15246e38eae7c6bff0f7fca731141
parent3a338521703dc8be1e0589684c734f870e2c0633 (diff)
all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()
g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
-rw-r--r--callouts/nm-dispatcher.c4
-rw-r--r--clients/Makefile.am1
-rw-r--r--clients/cli/nmcli.c7
-rw-r--r--clients/nm-online.c5
-rw-r--r--include/nm-test-utils.h4
-rw-r--r--libnm-core/nm-setting-private.h2
-rw-r--r--libnm-core/nm-setting.c4
-rw-r--r--libnm-core/nm-utils.c2
-rw-r--r--libnm-glib/libnm-glib-test.c5
-rw-r--r--libnm-glib/libnm_glib.c6
-rw-r--r--libnm-util/nm-param-spec-specialized.c4
-rw-r--r--libnm-util/nm-setting-private.h2
-rw-r--r--libnm-util/nm-setting.c4
-rw-r--r--libnm-util/tests/test-setting-dcb.c4
-rw-r--r--src/devices/nm-device-factory.h2
-rw-r--r--src/dhcp-manager/nm-dhcp-dhclient.c3
-rw-r--r--src/dhcp-manager/nm-dhcp-dhcpcd.c3
-rw-r--r--src/dhcp-manager/nm-dhcp-systemd.c2
-rw-r--r--src/main.c4
-rw-r--r--src/nm-iface-helper.c4
-rw-r--r--src/platform/tests/dump.c4
-rw-r--r--src/platform/tests/monitor.c5
-rw-r--r--src/platform/tests/platform.c4
-rw-r--r--src/ppp-manager/nm-pppd-plugin.c5
24 files changed, 34 insertions, 56 deletions
diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c
index 09eb0d3a3..d9fe147f4 100644
--- a/callouts/nm-dispatcher.c
+++ b/callouts/nm-dispatcher.c
@@ -652,9 +652,7 @@ main (int argc, char **argv)
g_option_context_free (opt_ctx);
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM));
g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT));
diff --git a/clients/Makefile.am b/clients/Makefile.am
index dea8f9e33..e30eb5d8e 100644
--- a/clients/Makefile.am
+++ b/clients/Makefile.am
@@ -5,6 +5,7 @@ AM_CPPFLAGS = \
-I${top_builddir}/libnm-core \
-I${top_srcdir}/libnm \
-I${top_builddir}/libnm \
+ -I${top_srcdir}/include \
$(GLIB_CFLAGS) \
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
-DNMLOCALEDIR=\"$(datadir)/locale\"
diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c
index 63c4b777a..c27798c23 100644
--- a/clients/cli/nmcli.c
+++ b/clients/cli/nmcli.c
@@ -38,6 +38,7 @@
#include "polkit-agent.h"
#include "nmcli.h"
+#include "nm-glib-compat.h"
#include "utils.h"
#include "common.h"
#include "connections.h"
@@ -607,10 +608,8 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
#endif
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
-
+ nm_g_type_init ();
+
/* Save terminal settings */
tcgetattr (STDIN_FILENO, &termios_orig);
diff --git a/clients/nm-online.c b/clients/nm-online.c
index bb0c97066..cd97e6cc1 100644
--- a/clients/nm-online.c
+++ b/clients/nm-online.c
@@ -41,6 +41,7 @@
#include <glib/gi18n.h>
#include <NetworkManager.h>
+#include "nm-glib-compat.h"
#define PROGRESS_STEPS 15
#define WAIT_STARTUP_TAG "wait-startup"
@@ -188,9 +189,7 @@ main (int argc, char *argv[])
}
remaining_ms = t_secs * 1000;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
client = nm_client_new (NULL, &error);
if (!client) {
diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h
index 144ebfc12..14d4bb451 100644
--- a/include/nm-test-utils.h
+++ b/include/nm-test-utils.h
@@ -302,9 +302,7 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_
__nmtst_internal.assert_logging = !!assert_logging;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
is_debug = g_test_verbose ();
diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h
index 2d34d509a..dc8d7fac2 100644
--- a/libnm-core/nm-setting-private.h
+++ b/libnm-core/nm-setting-private.h
@@ -92,7 +92,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \
-{ g_type_init (); g_type_ensure (x); }
+{ nm_g_type_init (); g_type_ensure (x); }
GVariant *_nm_setting_get_deprecated_virtual_interface_name (NMSetting *setting,
NMConnection *connection,
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index e1e81b5de..b6af31a4c 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -95,9 +95,7 @@ static void
_ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
registered_settings = g_hash_table_new (g_str_hash, g_str_equal);
registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal);
}
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index 7ec67cffc..3e1cf807e 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -240,7 +240,7 @@ _nm_utils_init (void)
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- g_type_init ();
+ nm_g_type_init ();
_nm_dbus_errors_init ();
}
diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c
index 7dc6823e2..da3bc5f6d 100644
--- a/libnm-glib/libnm-glib-test.c
+++ b/libnm-glib/libnm-glib-test.c
@@ -38,6 +38,7 @@
#include "nm-active-connection.h"
#include "nm-vpn-connection.h"
#include "nm-setting-ip4-config.h"
+#include "nm-glib-compat.h"
static gboolean
test_wireless_enabled (NMClient *client)
@@ -392,9 +393,7 @@ main (int argc, char *argv[])
{
NMClient *client;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
client = nm_client_new ();
if (!client) {
diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c
index fed801606..7acfcc95a 100644
--- a/libnm-glib/libnm_glib.c
+++ b/libnm-glib/libnm_glib.c
@@ -32,6 +32,8 @@
#include "NetworkManager.h"
#include "libnm_glib.h"
+#include "nm-glib-compat.h"
+
#define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist"
@@ -495,9 +497,7 @@ libnm_glib_init (void)
{
libnm_glib_ctx *ctx = NULL;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
if (!g_thread_supported ())
g_thread_init (NULL);
diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c
index acb8aec33..11f957499 100644
--- a/libnm-util/nm-param-spec-specialized.c
+++ b/libnm-util/nm-param-spec-specialized.c
@@ -953,9 +953,7 @@ main (int argc, char *argv[])
{
DBusGConnection *bus;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h
index 1b271d0c7..5e1122e81 100644
--- a/libnm-util/nm-setting-private.h
+++ b/libnm-util/nm-setting-private.h
@@ -101,7 +101,7 @@ gboolean _nm_setting_clear_secrets_with_flags (NMSetting *setting,
/* Ensure the setting's GType is registered at library load time */
#define NM_SETTING_REGISTER_TYPE(x) \
static void __attribute__((constructor)) register_setting (void) \
-{ g_type_init (); g_type_ensure (x); }
+{ nm_g_type_init (); g_type_ensure (x); }
NMSetting *nm_setting_find_in_list (GSList *settings_list, const char *setting_name);
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index 35ae01daf..39c1d2220 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -103,9 +103,7 @@ static void
_ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
_nm_value_transforms_register ();
registered_settings = g_hash_table_new (g_str_hash, g_str_equal);
registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal);
diff --git a/libnm-util/tests/test-setting-dcb.c b/libnm-util/tests/test-setting-dcb.c
index 36192cd33..8f0af2e6c 100644
--- a/libnm-util/tests/test-setting-dcb.c
+++ b/libnm-util/tests/test-setting-dcb.c
@@ -308,9 +308,7 @@ int main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
success = nm_utils_init (&error);
g_assert_no_error (error);
diff --git a/src/devices/nm-device-factory.h b/src/devices/nm-device-factory.h
index 34c056d20..6ae865ae8 100644
--- a/src/devices/nm-device-factory.h
+++ b/src/devices/nm-device-factory.h
@@ -262,7 +262,7 @@ extern const char *_nm_device_factory_no_default_settings[];
static void __attribute__((constructor)) \
register_device_factory_internal_##lower (void) \
{ \
- g_type_init (); \
+ nm_g_type_init (); \
g_type_ensure (NM_TYPE_##upper##_FACTORY); \
} \
\
diff --git a/src/dhcp-manager/nm-dhcp-dhclient.c b/src/dhcp-manager/nm-dhcp-dhclient.c
index a951e3ea5..1d88da446 100644
--- a/src/dhcp-manager/nm-dhcp-dhclient.c
+++ b/src/dhcp-manager/nm-dhcp-dhclient.c
@@ -44,6 +44,7 @@
#include "NetworkManagerUtils.h"
#include "nm-dhcp-listener.h"
#include "gsystem-local-alloc.h"
+#include "nm-glib-compat.h"
G_DEFINE_TYPE (NMDhcpDhclient, nm_dhcp_dhclient, NM_TYPE_DHCP_CLIENT)
@@ -669,7 +670,7 @@ nm_dhcp_dhclient_class_init (NMDhcpDhclientClass *dhclient_class)
static void __attribute__((constructor))
register_dhcp_dhclient (void)
{
- g_type_init ();
+ nm_g_type_init ();
_nm_dhcp_client_register (NM_TYPE_DHCP_DHCLIENT,
"dhclient",
nm_dhcp_dhclient_get_path,
diff --git a/src/dhcp-manager/nm-dhcp-dhcpcd.c b/src/dhcp-manager/nm-dhcp-dhcpcd.c
index bea89dc98..acbc76209 100644
--- a/src/dhcp-manager/nm-dhcp-dhcpcd.c
+++ b/src/dhcp-manager/nm-dhcp-dhcpcd.c
@@ -39,6 +39,7 @@
#include "nm-logging.h"
#include "NetworkManagerUtils.h"
#include "nm-dhcp-listener.h"
+#include "nm-glib-compat.h"
G_DEFINE_TYPE (NMDhcpDhcpcd, nm_dhcp_dhcpcd, NM_TYPE_DHCP_CLIENT)
@@ -213,7 +214,7 @@ nm_dhcp_dhcpcd_class_init (NMDhcpDhcpcdClass *dhcpcd_class)
static void __attribute__((constructor))
register_dhcp_dhclient (void)
{
- g_type_init ();
+ nm_g_type_init ();
_nm_dhcp_client_register (NM_TYPE_DHCP_DHCPCD,
"dhcpcd",
nm_dhcp_dhcpcd_get_path,
diff --git a/src/dhcp-manager/nm-dhcp-systemd.c b/src/dhcp-manager/nm-dhcp-systemd.c
index 05de2b340..44a0d49e4 100644
--- a/src/dhcp-manager/nm-dhcp-systemd.c
+++ b/src/dhcp-manager/nm-dhcp-systemd.c
@@ -846,7 +846,7 @@ nm_dhcp_systemd_class_init (NMDhcpSystemdClass *sdhcp_class)
static void __attribute__((constructor))
register_dhcp_dhclient (void)
{
- g_type_init ();
+ nm_g_type_init ();
_nm_dhcp_client_register (NM_TYPE_DHCP_SYSTEMD,
"internal",
NULL,
diff --git a/src/main.c b/src/main.c
index 4f906f557..65ba7a61d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -273,9 +273,7 @@ main (int argc, char *argv[])
char *bad_domains = NULL;
NMConfigCmdLineOptions *config_cli;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
_nm_utils_is_manager_process = TRUE;
diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c
index d416a517b..3cdd16596 100644
--- a/src/nm-iface-helper.c
+++ b/src/nm-iface-helper.c
@@ -336,9 +336,7 @@ main (int argc, char *argv[])
gconstpointer tmp;
gs_free NMUtilsIPv6IfaceId *iid = NULL;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
setpgid (getpid (), getpid ());
diff --git a/src/platform/tests/dump.c b/src/platform/tests/dump.c
index 54de1da70..b1f801235 100644
--- a/src/platform/tests/dump.c
+++ b/src/platform/tests/dump.c
@@ -123,9 +123,7 @@ dump_all (void)
int
main (int argc, char **argv)
{
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
g_assert (argc <= 2);
if (argc > 1 && !g_strcmp0 (argv[1], "--fake"))
diff --git a/src/platform/tests/monitor.c b/src/platform/tests/monitor.c
index 9aff10476..a989e63e1 100644
--- a/src/platform/tests/monitor.c
+++ b/src/platform/tests/monitor.c
@@ -6,15 +6,14 @@
#include "nm-fake-platform.h"
#include "nm-linux-platform.h"
#include "nm-logging.h"
+#include "nm-glib-compat.h"
int
main (int argc, char **argv)
{
GMainLoop *loop;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
loop = g_main_loop_new (NULL, FALSE);
nm_logging_setup ("debug", NULL, NULL, NULL);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index 60555414d..3e43ca57b 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -866,9 +866,7 @@ main (int argc, char **argv)
const command_t *command = NULL;
gboolean status = TRUE;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
if (*argv && !g_strcmp0 (argv[1], "--fake")) {
nm_fake_platform_setup ();
diff --git a/src/ppp-manager/nm-pppd-plugin.c b/src/ppp-manager/nm-pppd-plugin.c
index d5e8d7072..0a3bcca8d 100644
--- a/src/ppp-manager/nm-pppd-plugin.c
+++ b/src/ppp-manager/nm-pppd-plugin.c
@@ -38,6 +38,7 @@
#include "nm-dbus-interface.h"
#include "nm-pppd-plugin.h"
#include "nm-ppp-status.h"
+#include "nm-glib-compat.h"
int plugin_init (void);
@@ -372,9 +373,7 @@ plugin_init (void)
GDBusConnection *bus;
GError *err = NULL;
-#if !GLIB_CHECK_VERSION (2, 35, 0)
- g_type_init ();
-#endif
+ nm_g_type_init ();
g_message ("nm-ppp-plugin: (%s): initializing", __func__);