all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()
authorThomas Haller <thaller@redhat.com>
Thu, 10 Jul 2014 08:41:31 +0000 (10:41 +0200)
committerThomas Haller <thaller@redhat.com>
Sun, 12 Jul 2015 11:56:52 +0000 (13:56 +0200)
g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().

24 files changed:
callouts/nm-dispatcher.c
clients/Makefile.am
clients/cli/nmcli.c
clients/nm-online.c
include/nm-test-utils.h
libnm-core/nm-setting-private.h
libnm-core/nm-setting.c
libnm-core/nm-utils.c
libnm-glib/libnm-glib-test.c
libnm-glib/libnm_glib.c
libnm-util/nm-param-spec-specialized.c
libnm-util/nm-setting-private.h
libnm-util/nm-setting.c
libnm-util/tests/test-setting-dcb.c
src/devices/nm-device-factory.h
src/dhcp-manager/nm-dhcp-dhclient.c
src/dhcp-manager/nm-dhcp-dhcpcd.c
src/dhcp-manager/nm-dhcp-systemd.c
src/main.c
src/nm-iface-helper.c
src/platform/tests/dump.c
src/platform/tests/monitor.c
src/platform/tests/platform.c
src/ppp-manager/nm-pppd-plugin.c

index 09eb0d3..d9fe147 100644 (file)
@@ -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));
index dea8f9e..e30eb5d 100644 (file)
@@ -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\"
index 63c4b77..c27798c 100644 (file)
@@ -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);
 
index bb0c970..cd97e6c 100644 (file)
@@ -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) {
index 144ebfc..14d4bb4 100644 (file)
@@ -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 ();
 
index 2d34d50..dc8d7fa 100644 (file)
@@ -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,
index e1e81b5..b6af31a 100644 (file)
@@ -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);
        }
index 7ec67cf..3e1cf80 100644 (file)
@@ -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 ();
 }
index 7dc6823..da3bc5f 100644 (file)
@@ -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) {
index fed8016..7acfcc9 100644 (file)
@@ -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);
index acb8aec..11f9574 100644 (file)
@@ -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);
 
index 1b271d0..5e1122e 100644 (file)
@@ -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);
 
index 35ae01d..39c1d22 100644 (file)
@@ -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);
index 36192cd..8f0af2e 100644 (file)
@@ -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);
index 34c056d..6ae865a 100644 (file)
@@ -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); \
        } \
  \
index a951e3e..1d88da4 100644 (file)
@@ -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,
index bea89dc..acbc762 100644 (file)
@@ -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,
index 05de2b3..44a0d49 100644 (file)
@@ -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,
index 4f906f5..65ba7a6 100644 (file)
@@ -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;
 
index d416a51..3cdd165 100644 (file)
@@ -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 ());
 
index 54de1da..b1f8012 100644 (file)
@@ -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"))
index 9aff104..a989e63 100644 (file)
@@ -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);
index 6055541..3e43ca5 100644 (file)
@@ -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 ();
index d5e8d70..0a3bcca 100644 (file)
@@ -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__);