diff options
author | Thomas Haller <thaller@redhat.com> | 2014-07-10 10:41:31 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-07-10 15:29:04 +0200 |
commit | a4f3550a9637b30875af3699df1da613bb857f38 (patch) | |
tree | e6b2d17a4c4b10037a7e2a10589d50bae62ccc36 | |
parent | 1ae0d5895858d44190ee72e2b5fa38998ff61205 (diff) | |
download | NetworkManager-a4f3550a9637b30875af3699df1da613bb857f38.tar.gz |
all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()th/g_type_init
g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
Signed-off-by: Thomas Haller <thaller@redhat.com>
32 files changed, 49 insertions, 97 deletions
diff --git a/callouts/nm-avahi-autoipd-action.c b/callouts/nm-avahi-autoipd-action.c index f84eed7126..3e86c232e1 100644 --- a/callouts/nm-avahi-autoipd-action.c +++ b/callouts/nm-avahi-autoipd-action.c @@ -28,6 +28,8 @@ #include <dbus/dbus-glib-lowlevel.h> #include <dbus/dbus-glib.h> +#include "nm-glib-compat.h" + #define NM_AVAHI_AUTOIPD_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" #define NM_AVAHI_AUTOIPD_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" @@ -90,9 +92,7 @@ main (int argc, char *argv[]) dbus_bool_t result; char *event, *iface, *address; -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); if (argc != 4) { fprintf (stderr, "Error: expected 3 arguments (event, interface, address).\n"); diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c index 733af511fb..4aae336db8 100644 --- a/callouts/nm-dispatcher.c +++ b/callouts/nm-dispatcher.c @@ -703,9 +703,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/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index a91ae2b27a..728623725f 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -31,6 +31,7 @@ #include "nm-dbus-glib-types.h" #include "nm-dispatcher-api.h" #include "nm-utils.h" +#include "nm-glib-compat.h" /*******************************************/ @@ -643,9 +644,7 @@ 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 (); g_test_add_data_func ("/dispatcher/old_up", argv[1], (GTestDataFunc) test_old_up); g_test_add_data_func ("/dispatcher/old_down", argv[1], (GTestDataFunc) test_old_down); diff --git a/cli/src/nmcli.c b/cli/src/nmcli.c index ffd2cdbbc5..60a44a5f15 100644 --- a/cli/src/nmcli.c +++ b/cli/src/nmcli.c @@ -38,6 +38,7 @@ #include <nm-remote-settings.h> #include "nmcli.h" +#include "nm-glib-compat.h" #include "utils.h" #include "common.h" #include "connections.h" @@ -485,9 +486,7 @@ main (int argc, char *argv[]) textdomain (GETTEXT_PACKAGE); #endif -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); /* readline init */ rl_event_hook = event_hook_for_readline; diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 83c4080fe0..eac59d6d6d 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -171,9 +171,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-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index e38457f06b..49f6c7ee1d 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -36,6 +36,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) @@ -390,9 +391,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 a2a6d26ed0..8ac7f07568 100644 --- a/libnm-glib/libnm_glib.c +++ b/libnm-glib/libnm_glib.c @@ -30,6 +30,8 @@ #include "NetworkManager.h" #include "libnm_glib.h" +#include "nm-glib-compat.h" + #define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist" @@ -493,9 +495,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-glib/tests/test-nm-client.c b/libnm-glib/tests/test-nm-client.c index d5a79c75bc..7750b7c74e 100644 --- a/libnm-glib/tests/test-nm-client.c +++ b/libnm-glib/tests/test-nm-client.c @@ -915,9 +915,7 @@ main (int argc, char **argv) { g_assert (argc == 3); -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); g_test_init (&argc, &argv, NULL); diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c index e3ef7f22ef..ac40aa8bae 100644 --- a/libnm-glib/tests/test-remote-settings-client.c +++ b/libnm-glib/tests/test-remote-settings-client.c @@ -31,6 +31,7 @@ #include <nm-setting-connection.h> #include <nm-setting-wired.h> #include <nm-utils.h> +#include "nm-glib-compat.h" #include "nm-remote-settings.h" @@ -352,10 +353,8 @@ main (int argc, char **argv) g_assert (argc == 3); -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif - + nm_g_type_init (); + g_test_init (&argc, &argv, NULL); bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c index 27e498b5be..09a5c0ef76 100644 --- a/libnm-util/nm-param-spec-specialized.c +++ b/libnm-util/nm-param-spec-specialized.c @@ -954,9 +954,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.c b/libnm-util/nm-setting.c index 57960925d3..5fec1dc6e5 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -104,9 +104,7 @@ static void __attribute__((constructor)) _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-secrets.c b/libnm-util/tests/test-secrets.c index 73fc9224b0..5991b19577 100644 --- a/libnm-util/tests/test-secrets.c +++ b/libnm-util/tests/test-secrets.c @@ -723,9 +723,7 @@ int main (int argc, char **argv) GError *error = NULL; char *base; -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); if (!nm_utils_init (&error)) FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message); diff --git a/libnm-util/tests/test-setting-8021x.c b/libnm-util/tests/test-setting-8021x.c index 62889c61fc..538ee7fef9 100644 --- a/libnm-util/tests/test-setting-8021x.c +++ b/libnm-util/tests/test-setting-8021x.c @@ -412,9 +412,7 @@ int main (int argc, char **argv) if (argc < 3) FAIL ("init", "need at least two arguments: <path> <password>"); -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); if (!nm_utils_init (&error)) FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message); diff --git a/libnm-util/tests/test-setting-dcb.c b/libnm-util/tests/test-setting-dcb.c index de07f2c2a6..3681a8760a 100644 --- a/libnm-util/tests/test-setting-dcb.c +++ b/libnm-util/tests/test-setting-dcb.c @@ -305,9 +305,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/libnm-util/tests/test-settings-defaults.c b/libnm-util/tests/test-settings-defaults.c index 15412fed55..efec1494ef 100644 --- a/libnm-util/tests/test-settings-defaults.c +++ b/libnm-util/tests/test-settings-defaults.c @@ -104,9 +104,7 @@ int main (int argc, char **argv) GError *error = NULL; char *base; -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); if (!nm_utils_init (&error)) FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message); diff --git a/src/config/tests/test-config.c b/src/config/tests/test-config.c index fb6baaccaf..f57e411916 100644 --- a/src/config/tests/test-config.c +++ b/src/config/tests/test-config.c @@ -26,6 +26,7 @@ #include <nm-config.h> #include "nm-test-device.h" +#include "nm-glib-compat.h" static void setup_config (const char *config_file, const char *config_dir, ...) @@ -281,9 +282,7 @@ test_config_confdir_parse_error (void) int main (int argc, char **argv) { -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); g_test_init (&argc, &argv, NULL); diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c index 36d58f2a8a..394518fea7 100644 --- a/src/devices/wifi/tests/test-wifi-ap-utils.c +++ b/src/devices/wifi/tests/test-wifi-ap-utils.c @@ -28,6 +28,7 @@ #include "nm-setting-wireless.h" #include "nm-setting-wireless-security.h" #include "nm-setting-8021x.h" +#include "nm-glib-compat.h" #define DEBUG 1 @@ -1335,9 +1336,7 @@ main (int argc, char **argv) { gsize i; -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); g_test_init (&argc, &argv, NULL); diff --git a/src/dhcp-manager/tests/test-dhcp-dhclient.c b/src/dhcp-manager/tests/test-dhcp-dhclient.c index 1ab182a7c0..be8299f60d 100644 --- a/src/dhcp-manager/tests/test-dhcp-dhclient.c +++ b/src/dhcp-manager/tests/test-dhcp-dhclient.c @@ -577,9 +577,7 @@ 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 (); g_test_add_func ("/dhcp/dhclient/orig_missing", test_orig_missing); g_test_add_func ("/dhcp/dhclient/override_client_id", test_override_client_id); diff --git a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c index 07dbc0f724..95cf21ac9e 100644 --- a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c +++ b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c @@ -104,9 +104,7 @@ 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 (); g_test_add_func ("/dnsmasq-manager/address-ranges", test_address_ranges); diff --git a/src/main.c b/src/main.c index 0ba65b0b8a..d4cefb1704 100644 --- a/src/main.c +++ b/src/main.c @@ -563,9 +563,7 @@ main (int argc, char *argv[]) nm_logging_syslog_openlog (debug); -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); dbus_threads_init_default (); diff --git a/src/platform/tests/dump.c b/src/platform/tests/dump.c index e97ef138cb..fe0f3f4fac 100644 --- a/src/platform/tests/dump.c +++ b/src/platform/tests/dump.c @@ -120,9 +120,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 d56cc2bf82..2634e84ea5 100644 --- a/src/platform/tests/monitor.c +++ b/src/platform/tests/monitor.c @@ -4,15 +4,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 ea8bd0e3b3..8a8e46c8b5 100644 --- a/src/platform/tests/platform.c +++ b/src/platform/tests/platform.c @@ -854,9 +854,7 @@ main (int argc, char **argv) gboolean status = TRUE; int error; -#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 e6ee86f7a4..563183aa45 100644 --- a/src/ppp-manager/nm-pppd-plugin.c +++ b/src/ppp-manager/nm-pppd-plugin.c @@ -34,6 +34,7 @@ #include "nm-pppd-plugin.h" #include "nm-ppp-status.h" #include "nm-dbus-glib-types.h" +#include "nm-glib-compat.h" int plugin_init (void); @@ -325,9 +326,7 @@ plugin_init (void) DBusGConnection *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__); diff --git a/src/rdisc/tests/rdisc.c b/src/rdisc/tests/rdisc.c index 1fdf5b67a5..6d0d57ccbd 100644 --- a/src/rdisc/tests/rdisc.c +++ b/src/rdisc/tests/rdisc.c @@ -39,9 +39,7 @@ main (int argc, char **argv) const char *ifname; char mac[6] = { 0x02, 0xaa, 0xbb, 0xcc, 0xdd, 0xee }; -#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", "ip6", NULL, NULL); diff --git a/src/settings/plugins/ifupdown/tests/test-ifupdown.c b/src/settings/plugins/ifupdown/tests/test-ifupdown.c index 8386428703..dc16237b20 100644 --- a/src/settings/plugins/ifupdown/tests/test-ifupdown.c +++ b/src/settings/plugins/ifupdown/tests/test-ifupdown.c @@ -932,9 +932,7 @@ main (int argc, char **argv) { GError *error = NULL; -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); if (!nm_utils_init (&error)) FAIL ("nm-utils-init", "failed to initialize libnm-util: %s", error->message); diff --git a/src/settings/tests/test-wired-defname.c b/src/settings/tests/test-wired-defname.c index 2d88dd7759..a9b9e98eea 100644 --- a/src/settings/tests/test-wired-defname.c +++ b/src/settings/tests/test-wired-defname.c @@ -24,6 +24,7 @@ #include <nm-connection.h> #include <nm-setting-connection.h> #include "nm-settings-utils.h" +#include "nm-glib-compat.h" static NMConnection * _new_connection (const char *id) @@ -123,9 +124,7 @@ test_defname_multiple_conflicts (void) int main (int argc, char **argv) { -#if !GLIB_CHECK_VERSION (2, 35, 0) - g_type_init (); -#endif + nm_g_type_init (); g_test_init (&argc, &argv, NULL); diff --git a/src/tests/test-dcb.c b/src/tests/test-dcb.c index c28f05b920..fd52ae15ea 100644 --- a/src/tests/test-dcb.c +++ b/src/tests/test-dcb.c @@ -22,6 +22,7 @@ #include <string.h> #include "nm-dcb.h" +#include "nm-glib-compat.h" typedef struct { guint num; @@ -338,9 +339,7 @@ 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 (); g_test_add_func ("/dcb/fcoe", test_dcb_fcoe); g_test_add_func ("/dcb/iscsi", test_dcb_iscsi); diff --git a/src/tests/test-general.c b/src/tests/test-general.c index 11c03f0dbe..03956ca050 100644 --- a/src/tests/test-general.c +++ b/src/tests/test-general.c @@ -593,9 +593,7 @@ 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 (); g_test_add_func ("/general/nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64); g_test_add_func ("/general/nm_utils_ip6_address_clear_host_address", test_nm_utils_ip6_address_clear_host_address); diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c index 3eee5f1366..cc5d68c802 100644 --- a/src/tests/test-ip4-config.c +++ b/src/tests/test-ip4-config.c @@ -23,6 +23,7 @@ #include <arpa/inet.h> #include "nm-ip4-config.h" +#include "nm-glib-compat.h" static void addr_init (NMPlatformIP4Address *a, const char *addr, const char *peer, guint plen) @@ -340,9 +341,7 @@ 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 (); g_test_add_func ("/ip4-config/subtract", test_subtract); g_test_add_func ("/ip4-config/compare-with-source", test_compare_with_source); diff --git a/src/tests/test-resolvconf-capture.c b/src/tests/test-resolvconf-capture.c index cde4bbe5be..7b7ac8ea41 100644 --- a/src/tests/test-resolvconf-capture.c +++ b/src/tests/test-resolvconf-capture.c @@ -208,9 +208,7 @@ 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 (); g_test_add_func ("/resolvconf-capture/empty", test_capture_empty); g_test_add_func ("/resolvconf-capture/basic4", test_capture_basic4); diff --git a/test/nm-online.c b/test/nm-online.c index 3fcb9601b7..2eddbca823 100644 --- a/test/nm-online.c +++ b/test/nm-online.c @@ -41,6 +41,7 @@ #include <glib/gi18n.h> #include "nm-client.h" +#include "nm-glib-compat.h" #define PROGRESS_STEPS 15 #define WAIT_STARTUP_TAG "wait-startup" @@ -187,9 +188,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 (); if (!client) { |