From 8a46b25cfa8c33daa8af37bb8103ca02286001b1 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 2 Jan 2018 15:47:37 +0100 Subject: [PATCH] all: require glib 2.40 RHEL 7.1 and Ubuntu 14.04 LTS both have this. https://bugzilla.gnome.org/show_bug.cgi?id=792323 --- clients/cli/nmcli.c | 2 - clients/common/tests/test-general.c | 4 +- clients/nm-online.c | 2 - clients/tui/newt/nmt-newt-utils.c | 10 - configure.ac | 4 +- dispatcher/nm-dispatcher.c | 2 - docs/libnm-glib/Makefile.am | 3 - docs/libnm-util/Makefile.am | 3 - docs/libnm/Makefile.am | 3 - examples/C/glib/add-connection-gdbus.c | 5 - examples/C/glib/add-connection-libnm.c | 5 - .../C/glib/get-active-connections-gdbus.c | 5 - examples/C/glib/get-ap-info-libnm.c | 5 - examples/C/glib/list-connections-gdbus.c | 5 - examples/C/glib/list-connections-libnm.c | 5 - examples/C/glib/monitor-nm-running-gdbus.c | 5 - examples/C/glib/monitor-nm-state-gdbus.c | 5 - libnm-core/nm-setting-private.h | 2 +- libnm-core/nm-setting.c | 3 +- libnm-core/nm-utils.c | 2 - libnm-core/tests/test-general.c | 62 --- libnm-glib/libnm-glib-test.c | 2 - libnm-glib/libnm_glib.c | 2 - libnm-util/nm-param-spec-specialized.c | 2 - libnm-util/nm-setting-private.h | 2 +- libnm-util/nm-setting.c | 1 - shared/nm-utils/nm-dedup-multi.c | 6 +- shared/nm-utils/nm-glib.h | 374 +----------------- shared/nm-utils/nm-test-utils.h | 16 +- src/devices/nm-device.c | 4 +- src/dhcp/nm-dhcp-helper.c | 2 - src/main.c | 2 - src/nm-bus-manager.c | 4 - src/nm-checkpoint-manager.c | 4 +- src/nm-config.c | 2 +- src/nm-iface-helper.c | 2 - src/nm-manager.c | 10 +- src/nm-policy.c | 4 +- src/platform/nm-platform.c | 6 +- src/ppp/nm-pppd-plugin.c | 2 - 40 files changed, 26 insertions(+), 563 deletions(-) diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index b0b31261c0..d1c23249f5 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -626,8 +626,6 @@ main (int argc, char *argv[]) textdomain (GETTEXT_PACKAGE); #endif - nm_g_type_init (); - /* Save terminal settings */ tcgetattr (STDIN_FILENO, &termios_orig); diff --git a/clients/common/tests/test-general.c b/clients/common/tests/test-general.c index a833e263c3..8f96eb262f 100644 --- a/clients/common/tests/test-general.c +++ b/clients/common/tests/test-general.c @@ -86,7 +86,7 @@ test_client_meta_check (void) g_assert (pi->setting_info == info); g_assert (pi->property_name); - g_assert (nm_g_hash_table_add (property_names, (gpointer) pi->property_name)); + g_assert (g_hash_table_add (property_names, (gpointer) pi->property_name)); g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, FALSE)); g_assert_cmpstr (pi->property_name, ==, pi->meta_type->get_name ((const NMMetaAbstractInfo *) pi, TRUE)); @@ -107,7 +107,7 @@ test_client_meta_check (void) for (i = 0; info->valid_parts[i]; i++) { g_assert (info->valid_parts[i]->setting_info); - g_assert (nm_g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info)); + g_assert (g_hash_table_add (dup, (gpointer) info->valid_parts[i]->setting_info)); if (i == 0) { g_assert (info->valid_parts[i]->setting_info == &nm_meta_setting_infos_editor[NM_META_SETTING_TYPE_CONNECTION]); diff --git a/clients/nm-online.c b/clients/nm-online.c index 5bc80795b9..77a11321d0 100644 --- a/clients/nm-online.c +++ b/clients/nm-online.c @@ -244,8 +244,6 @@ main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - nm_g_type_init (); - data.start_timestamp_ms = _now_ms (); opt_ctx = g_option_context_new (NULL); diff --git a/clients/tui/newt/nmt-newt-utils.c b/clients/tui/newt/nmt-newt-utils.c index f37a851e6c..213e198b64 100644 --- a/clients/tui/newt/nmt-newt-utils.c +++ b/clients/tui/newt/nmt-newt-utils.c @@ -359,21 +359,11 @@ nmt_newt_edit_string (const char *data) goto done; } -#if GLIB_CHECK_VERSION (2, 34, 0) - G_GNUC_BEGIN_IGNORE_DEPRECATIONS if (!g_spawn_check_exit_status (status, &error)) { nmt_newt_message_dialog (_("Editor failed: %s"), error->message); g_error_free (error); goto done; } - G_GNUC_END_IGNORE_DEPRECATIONS -#else - if (WIFEXITED (status)) { - if (WEXITSTATUS (status) != 0) - nmt_newt_message_dialog (_("Editor failed with status %d"), WEXITSTATUS (status)); - } else if (WIFSIGNALED (status)) - nmt_newt_message_dialog (_("Editor failed with signal %d"), WTERMSIG (status)); -#endif if (!g_file_get_contents (filename, &new_data, NULL, &error)) { nmt_newt_message_dialog (_("Could not re-read file: %s"), error->message); diff --git a/configure.ac b/configure.ac index 977efe67a6..55d9cebb36 100644 --- a/configure.ac +++ b/configure.ac @@ -234,14 +234,14 @@ AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen") PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0], [AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/tap-driver.sh') AC_SUBST(AM_TESTS_FD_REDIRECT, '--tap')], - [PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32 gmodule-2.0) + [PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.40 gmodule-2.0) AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/test-driver')]) dnl GLIB_VERSION_MIN_REQUIRED should match the version above. dnl GLIB_VERSION_MAX_ALLOWED should be set to the same version; dnl nm-glib.h will cause it to be overridden for the functions dnl we have compat versions of. -GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32" +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40" AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) diff --git a/dispatcher/nm-dispatcher.c b/dispatcher/nm-dispatcher.c index 6bb5221858..6d1d27e8e2 100644 --- a/dispatcher/nm-dispatcher.c +++ b/dispatcher/nm-dispatcher.c @@ -916,8 +916,6 @@ main (int argc, char **argv) g_option_context_free (opt_ctx); - 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/docs/libnm-glib/Makefile.am b/docs/libnm-glib/Makefile.am index 662db95ff2..5273148a94 100644 --- a/docs/libnm-glib/Makefile.am +++ b/docs/libnm-glib/Makefile.am @@ -15,9 +15,6 @@ DOC_SOURCE_DIR=$(top_srcdir)/libnm-glib # Extra options to supply to gtkdoc-scan. SCAN_OPTIONS= -# Extra options to supply to gtkdoc-scangobj. -SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();' - # Extra options to supply to gtkdoc-mkdb. MKDB_OPTIONS=--sgml-mode --output-format=xml diff --git a/docs/libnm-util/Makefile.am b/docs/libnm-util/Makefile.am index 4e8ede134a..75badb7791 100644 --- a/docs/libnm-util/Makefile.am +++ b/docs/libnm-util/Makefile.am @@ -17,9 +17,6 @@ DOC_SOURCE_DIR= \ # Extra options to supply to gtkdoc-scan. SCAN_OPTIONS=--rebuild-types --rebuild-sections -# Extra options to supply to gtkdoc-scangobj. -SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();' - # Extra options to supply to gtkdoc-mkdb. MKDB_OPTIONS=--sgml-mode --output-format=xml diff --git a/docs/libnm/Makefile.am b/docs/libnm/Makefile.am index 3c1f803a4a..3ab55a8c43 100644 --- a/docs/libnm/Makefile.am +++ b/docs/libnm/Makefile.am @@ -19,9 +19,6 @@ DOC_SOURCE_DIR= \ # Extra options to supply to gtkdoc-scan. SCAN_OPTIONS=--rebuild-types --rebuild-sections -# Extra options to supply to gtkdoc-scangobj. -SCANGOBJ_OPTIONS=--type-init-func 'g_type_init();' - # Extra options to supply to gtkdoc-mkdb. MKDB_OPTIONS=--sgml-mode --output-format=xml diff --git a/examples/C/glib/add-connection-gdbus.c b/examples/C/glib/add-connection-gdbus.c index 7c8edf6882..1045db380c 100644 --- a/examples/C/glib/add-connection-gdbus.c +++ b/examples/C/glib/add-connection-gdbus.c @@ -124,11 +124,6 @@ main (int argc, char *argv[]) GDBusProxy *proxy; GError *error = NULL; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - /* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, diff --git a/examples/C/glib/add-connection-libnm.c b/examples/C/glib/add-connection-libnm.c index 86915ea2c1..18b3d680f2 100644 --- a/examples/C/glib/add-connection-libnm.c +++ b/examples/C/glib/add-connection-libnm.c @@ -105,11 +105,6 @@ main (int argc, char *argv[]) GMainLoop *loop; GError *error = NULL; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - loop = g_main_loop_new (NULL, FALSE); /* Connect to NetworkManager */ diff --git a/examples/C/glib/get-active-connections-gdbus.c b/examples/C/glib/get-active-connections-gdbus.c index 217fd7ac0d..033582fb39 100644 --- a/examples/C/glib/get-active-connections-gdbus.c +++ b/examples/C/glib/get-active-connections-gdbus.c @@ -251,11 +251,6 @@ main (int argc, char *argv[]) { GDBusProxy *props_proxy; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - /* Create a D-Bus proxy to get the object properties from the NM Manager * object. NM_DBUS_* defines are from nm-dbus-interface.h. */ diff --git a/examples/C/glib/get-ap-info-libnm.c b/examples/C/glib/get-ap-info-libnm.c index a548d12dd8..2c1c019498 100644 --- a/examples/C/glib/get-ap-info-libnm.c +++ b/examples/C/glib/get-ap-info-libnm.c @@ -202,11 +202,6 @@ main (int argc, char *argv[]) int i; GError *error = NULL; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - /* Get NMClient object */ client = nm_client_new (NULL, &error); if (!client) { diff --git a/examples/C/glib/list-connections-gdbus.c b/examples/C/glib/list-connections-gdbus.c index 088df1d88f..b8e77dc97b 100644 --- a/examples/C/glib/list-connections-gdbus.c +++ b/examples/C/glib/list-connections-gdbus.c @@ -65,11 +65,6 @@ main (int argc, char *argv[]) { GDBusProxy *proxy; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - /* Create a D-Bus proxy; NM_DBUS_* defined in nm-dbus-interface.h */ proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, diff --git a/examples/C/glib/list-connections-libnm.c b/examples/C/glib/list-connections-libnm.c index 5dc38201ab..1b3ed8d17d 100644 --- a/examples/C/glib/list-connections-libnm.c +++ b/examples/C/glib/list-connections-libnm.c @@ -69,11 +69,6 @@ main (int argc, char *argv[]) const GPtrArray *connections; int i; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - if (!(client = nm_client_new (NULL, &error))) { g_message ("Error: Could not connect to NetworkManager: %s.", error->message); g_error_free (error); diff --git a/examples/C/glib/monitor-nm-running-gdbus.c b/examples/C/glib/monitor-nm-running-gdbus.c index c19569b521..68617884eb 100644 --- a/examples/C/glib/monitor-nm-running-gdbus.c +++ b/examples/C/glib/monitor-nm-running-gdbus.c @@ -56,11 +56,6 @@ main (int argc, char *argv[]) GMainLoop *loop; GBusNameWatcherFlags flags; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - g_print ("Monitor 'org.freedesktop.NetworkManager' D-Bus name\n"); g_print ("===================================================\n"); diff --git a/examples/C/glib/monitor-nm-state-gdbus.c b/examples/C/glib/monitor-nm-state-gdbus.c index 913644d2b4..204ff570eb 100644 --- a/examples/C/glib/monitor-nm-state-gdbus.c +++ b/examples/C/glib/monitor-nm-state-gdbus.c @@ -90,11 +90,6 @@ main (int argc, char *argv[]) GDBusProxyFlags flags; GDBusProxy *proxy; -#if !GLIB_CHECK_VERSION (2, 35, 0) - /* Initialize GType system */ - g_type_init (); -#endif - /* Monitor 'StateChanged' signal on 'org.freedesktop.NetworkManager' interface */ g_print ("Monitor NetworkManager's state\n"); g_print ("==============================\n"); diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h index 1e926a66e1..6c50178d64 100644 --- a/libnm-core/nm-setting-private.h +++ b/libnm-core/nm-setting-private.h @@ -89,7 +89,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) \ -{ nm_g_type_init (); g_type_ensure (x); } +{ 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 5a06fd062b..4c76ed3199 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -94,7 +94,6 @@ static void _ensure_registered (void) { if (G_UNLIKELY (registered_settings == NULL)) { - nm_g_type_init (); registered_settings = g_hash_table_new (nm_str_hash, g_str_equal); registered_settings_by_type = g_hash_table_new (_nm_gtype_hash, _nm_gtype_equal); } @@ -816,7 +815,7 @@ _nm_setting_new_from_dbus (GType setting_type, g_variant_unref (entry_key); g_variant_unref (entry); - if (!nm_g_hash_table_add (keys, key)) { + if (!g_hash_table_add (keys, key)) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_SETTING, _("duplicate property")); g_prefix_error (error, "%s.%s: ", nm_setting_get_name (setting), key); diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index efb8a9befb..910dfc94f3 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -253,8 +253,6 @@ _nm_utils_init (void) bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - nm_g_type_init (); - _nm_dbus_errors_init (); } diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 9cf08c5d8c..544eb3c06d 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -6093,66 +6093,6 @@ again: /*****************************************************************************/ -static void -test_g_ptr_array_insert (void) -{ - /* this test only makes sense on a recent glib, where we compare our compat - * with the original implementation. */ -#if GLIB_CHECK_VERSION(2, 40, 0) - gs_unref_ptrarray GPtrArray *arr1 = g_ptr_array_new (); - gs_unref_ptrarray GPtrArray *arr2 = g_ptr_array_new (); - GRand *rand = nmtst_get_rand (); - guint i; - - for (i = 0; i < 560; i++) { - gint32 idx = g_rand_int_range (rand, -1, arr1->len + 1); - - g_ptr_array_insert (arr1, idx, GINT_TO_POINTER (i)); - _nm_g_ptr_array_insert (arr2, idx, GINT_TO_POINTER (i)); - - g_assert_cmpint (arr1->len, ==, arr2->len); - g_assert (memcmp (arr1->pdata, arr2->pdata, arr1->len * sizeof (gpointer)) == 0); - } -#endif -} - -/*****************************************************************************/ - -static void -test_g_hash_table_get_keys_as_array (void) -{ - GHashTable *table = g_hash_table_new (nm_str_hash, g_str_equal); - guint length = 0; - char **keys; - - g_hash_table_insert (table, "one", "1"); - g_hash_table_insert (table, "two", "2"); - g_hash_table_insert (table, "three", "3"); - - keys = (char **) _nm_g_hash_table_get_keys_as_array (table, &length); - g_assert (keys); - g_assert_cmpuint (length, ==, 3); - - g_assert ( !strcmp (keys[0], "one") - || !strcmp (keys[1], "one") - || !strcmp (keys[2], "one")); - - g_assert ( !strcmp (keys[0], "two") - || !strcmp (keys[1], "two") - || !strcmp (keys[2], "two")); - - g_assert ( !strcmp (keys[0], "three") - || !strcmp (keys[1], "three") - || !strcmp (keys[2], "three")); - - g_assert (!keys[3]); - - g_free (keys); - g_hash_table_unref (table); -} - -/*****************************************************************************/ - static int _test_find_binary_search_cmp (gconstpointer a, gconstpointer b, gpointer dummy) { @@ -7074,8 +7014,6 @@ int main (int argc, char **argv) g_test_add_func ("/core/general/_nm_utils_ascii_str_to_int64", test_nm_utils_ascii_str_to_int64); g_test_add_func ("/core/general/nm_utils_is_power_of_two", test_nm_utils_is_power_of_two); - g_test_add_func ("/core/general/_glib_compat_g_ptr_array_insert", test_g_ptr_array_insert); - g_test_add_func ("/core/general/_glib_compat_g_hash_table_get_keys_as_array", test_g_hash_table_get_keys_as_array); g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search", test_nm_utils_ptrarray_find_binary_search); g_test_add_func ("/core/general/_nm_utils_ptrarray_find_binary_search_with_duplicates", test_nm_utils_ptrarray_find_binary_search_with_duplicates); g_test_add_func ("/core/general/_nm_utils_strstrdictkey", test_nm_utils_strstrdictkey); diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index c3c0ff19c3..5f15a51062 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -400,8 +400,6 @@ main (int argc, char *argv[]) { NMClient *client; - nm_g_type_init (); - client = nm_client_new (); if (!client) { exit (1); diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c index ec25a2d974..2c0b9657c8 100644 --- a/libnm-glib/libnm_glib.c +++ b/libnm-glib/libnm_glib.c @@ -495,8 +495,6 @@ libnm_glib_init (void) { libnm_glib_ctx *ctx = NULL; - nm_g_type_init (); - if (!g_thread_supported ()) g_thread_init (NULL); dbus_g_thread_init (); diff --git a/libnm-util/nm-param-spec-specialized.c b/libnm-util/nm-param-spec-specialized.c index a4e01d8f57..fc8d0318af 100644 --- a/libnm-util/nm-param-spec-specialized.c +++ b/libnm-util/nm-param-spec-specialized.c @@ -956,8 +956,6 @@ main (int argc, char *argv[]) { DBusGConnection *bus; - nm_g_type_init (); - bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); compare_ints (); diff --git a/libnm-util/nm-setting-private.h b/libnm-util/nm-setting-private.h index ba15a238da..db5f3afa60 100644 --- a/libnm-util/nm-setting-private.h +++ b/libnm-util/nm-setting-private.h @@ -105,7 +105,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) \ -{ nm_g_type_init (); g_type_ensure (x); } +{ 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 3bcefbc57c..760b3cac21 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -102,7 +102,6 @@ static void _ensure_registered (void) { if (G_UNLIKELY (registered_settings == NULL)) { - 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/shared/nm-utils/nm-dedup-multi.c b/shared/nm-utils/nm-dedup-multi.c index ee310a7b1b..a0944f4699 100644 --- a/shared/nm-utils/nm-dedup-multi.c +++ b/shared/nm-utils/nm-dedup-multi.c @@ -386,10 +386,10 @@ _add (NMDedupMultiIndex *self, head_entry->len++; if ( add_head_entry - && !nm_g_hash_table_add (self->idx_entries, head_entry)) + && !g_hash_table_add (self->idx_entries, head_entry)) nm_assert_not_reached (); - if (!nm_g_hash_table_add (self->idx_entries, entry)) + if (!g_hash_table_add (self->idx_entries, entry)) nm_assert_not_reached (); NM_SET_OUT (out_entry, entry); @@ -870,7 +870,7 @@ nm_dedup_multi_index_obj_intern (NMDedupMultiIndex *self, nm_assert (obj_new); nm_assert (!obj_new->_multi_idx); - if (!nm_g_hash_table_add (self->idx_objs, (gpointer) obj_new)) + if (!g_hash_table_add (self->idx_objs, (gpointer) obj_new)) nm_assert_not_reached (); ((NMDedupMultiObj *) obj_new)->_multi_idx = self; diff --git a/shared/nm-utils/nm-glib.h b/shared/nm-utils/nm-glib.h index 599890e071..b20e978f45 100644 --- a/shared/nm-utils/nm-glib.h +++ b/shared/nm-utils/nm-glib.h @@ -14,7 +14,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * Copyright 2008 - 2011 Red Hat, Inc. + * Copyright 2008 - 2018 Red Hat, Inc. */ #ifndef __NM_GLIB_H__ @@ -40,84 +40,6 @@ #endif -static inline void -__g_type_ensure (GType type) -{ -#if !GLIB_CHECK_VERSION(2,34,0) - if (G_UNLIKELY (type == (GType)-1)) - g_error ("can't happen"); -#else - G_GNUC_BEGIN_IGNORE_DEPRECATIONS; - g_type_ensure (type); - G_GNUC_END_IGNORE_DEPRECATIONS; -#endif -} -#define g_type_ensure __g_type_ensure - -#if !GLIB_CHECK_VERSION(2,34,0) - -#define g_clear_pointer(pp, destroy) \ - G_STMT_START { \ - G_STATIC_ASSERT (sizeof *(pp) == sizeof (gpointer)); \ - /* Only one access, please */ \ - gpointer *_pp = (gpointer *) (pp); \ - gpointer _p; \ - /* This assignment is needed to avoid a gcc warning */ \ - GDestroyNotify _destroy = (GDestroyNotify) (destroy); \ - \ - _p = *_pp; \ - if (_p) \ - { \ - *_pp = NULL; \ - _destroy (_p); \ - } \ - } G_STMT_END - -/* These are used to clean up the output of test programs; we can just let - * them no-op in older glib. - */ -#define g_test_expect_message(log_domain, log_level, pattern) -#define g_test_assert_expected_messages() - -#else - -/* We build with -DGLIB_MAX_ALLOWED_VERSION set to 2.32 to make sure we don't - * accidentally use new API that we shouldn't. But we don't want warnings for - * the APIs that we emulate above. - */ - -#define g_test_expect_message(domain, level, format...) \ - G_STMT_START { \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - g_test_expect_message (domain, level, format); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - } G_STMT_END - -#define g_test_assert_expected_messages_internal(domain, file, line, func) \ - G_STMT_START { \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - g_test_assert_expected_messages_internal (domain, file, line, func); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - } G_STMT_END - -#endif - - -#if GLIB_CHECK_VERSION (2, 35, 0) -/* For glib >= 2.36, g_type_init() is deprecated. - * But since 2.35.1 (7c42ab23b55c43ab96d0ac2124b550bf1f49c1ec) this function - * does nothing. Replace the call with empty statement. */ -#define nm_g_type_init() G_STMT_START { (void) 0; } G_STMT_END -#else -#define nm_g_type_init() G_STMT_START { g_type_init (); } G_STMT_END -#endif - - -/* g_test_initialized() is only available since glib 2.36. */ -#if !GLIB_CHECK_VERSION (2, 36, 0) -#define g_test_initialized() (g_test_config_vars->test_initialized) -#endif - /* g_assert_cmpmem() is only available since glib 2.46. */ #if !GLIB_CHECK_VERSION (2, 45, 7) #define g_assert_cmpmem(m1, l1, m2, l2) G_STMT_START {\ @@ -146,239 +68,6 @@ nm_glib_check_version (guint major, guint minor, guint micro) && glib_micro_version < micro)); } -/* g_test_skip() is only available since glib 2.38. Add a compatibility wrapper. */ -static inline void -__nmtst_g_test_skip (const gchar *msg) -{ -#if GLIB_CHECK_VERSION (2, 38, 0) - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - g_test_skip (msg); - G_GNUC_END_IGNORE_DEPRECATIONS -#else - g_debug ("%s", msg); -#endif -} -#define g_test_skip __nmtst_g_test_skip - - -/* g_test_add_data_func_full() is only available since glib 2.34. Add a compatibility wrapper. */ -static inline void -__g_test_add_data_func_full (const char *testpath, - gpointer test_data, - GTestDataFunc test_func, - GDestroyNotify data_free_func) -{ -#if GLIB_CHECK_VERSION (2, 34, 0) - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - g_test_add_data_func_full (testpath, test_data, test_func, data_free_func); - G_GNUC_END_IGNORE_DEPRECATIONS -#else - g_return_if_fail (testpath != NULL); - g_return_if_fail (testpath[0] == '/'); - g_return_if_fail (test_func != NULL); - - g_test_add_vtable (testpath, 0, test_data, NULL, - (GTestFixtureFunc) test_func, - (GTestFixtureFunc) data_free_func); -#endif -} -#define g_test_add_data_func_full __g_test_add_data_func_full - - -#if !GLIB_CHECK_VERSION (2, 34, 0) -#define G_DEFINE_QUARK(QN, q_n) \ -GQuark \ -q_n##_quark (void) \ -{ \ - static GQuark q; \ - \ - if G_UNLIKELY (q == 0) \ - q = g_quark_from_static_string (#QN); \ - \ - return q; \ -} -#endif - - -static inline gboolean -nm_g_hash_table_replace (GHashTable *hash, gpointer key, gpointer value) -{ - /* glib 2.40 added a return value indicating whether the key already existed - * (910191597a6c2e5d5d460e9ce9efb4f47d9cc63c). */ -#if GLIB_CHECK_VERSION(2, 40, 0) - return g_hash_table_replace (hash, key, value); -#else - gboolean contained = g_hash_table_contains (hash, key); - - g_hash_table_replace (hash, key, value); - return !contained; -#endif -} - -static inline gboolean -nm_g_hash_table_insert (GHashTable *hash, gpointer key, gpointer value) -{ - /* glib 2.40 added a return value indicating whether the key already existed - * (910191597a6c2e5d5d460e9ce9efb4f47d9cc63c). */ -#if GLIB_CHECK_VERSION(2, 40, 0) - return g_hash_table_insert (hash, key, value); -#else - gboolean contained = g_hash_table_contains (hash, key); - - g_hash_table_insert (hash, key, value); - return !contained; -#endif -} - -static inline gboolean -nm_g_hash_table_add (GHashTable *hash, gpointer key) -{ - /* glib 2.40 added a return value indicating whether the key already existed - * (910191597a6c2e5d5d460e9ce9efb4f47d9cc63c). */ -#if GLIB_CHECK_VERSION(2, 40, 0) - return g_hash_table_add (hash, key); -#else - gboolean contained = g_hash_table_contains (hash, key); - - g_hash_table_add (hash, key); - return !contained; -#endif -} - -#if !GLIB_CHECK_VERSION(2, 40, 0) || defined (NM_GLIB_COMPAT_H_TEST) -static inline void -_nm_g_ptr_array_insert (GPtrArray *array, - gint index_, - gpointer data) -{ - g_return_if_fail (array); - g_return_if_fail (index_ >= -1); - g_return_if_fail (index_ <= (gint) array->len); - - g_ptr_array_add (array, data); - - if (index_ != -1 && index_ != (gint) (array->len - 1)) { - memmove (&(array->pdata[index_ + 1]), - &(array->pdata[index_]), - (array->len - index_ - 1) * sizeof (gpointer)); - array->pdata[index_] = data; - } -} -#endif -#if !GLIB_CHECK_VERSION(2, 40, 0) -#define g_ptr_array_insert(array, index, data) G_STMT_START { _nm_g_ptr_array_insert (array, index, data); } G_STMT_END -#else -#define g_ptr_array_insert(array, index, data) \ - G_STMT_START { \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - g_ptr_array_insert (array, index, data); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - } G_STMT_END -#endif - - -#if !GLIB_CHECK_VERSION (2, 40, 0) -static inline gboolean -_g_key_file_save_to_file (GKeyFile *key_file, - const gchar *filename, - GError **error) -{ - gchar *contents; - gboolean success; - gsize length; - - g_return_val_if_fail (key_file != NULL, FALSE); - g_return_val_if_fail (filename != NULL, FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - - contents = g_key_file_to_data (key_file, &length, NULL); - g_assert (contents != NULL); - - success = g_file_set_contents (filename, contents, length, error); - g_free (contents); - - return success; -} -#define g_key_file_save_to_file(key_file, filename, error) \ - _g_key_file_save_to_file (key_file, filename, error) -#else -#define g_key_file_save_to_file(key_file, filename, error) \ - ({ \ - gboolean _success; \ - \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - _success = g_key_file_save_to_file (key_file, filename, error); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - _success; \ - }) -#endif - - -#if GLIB_CHECK_VERSION (2, 36, 0) -#define g_credentials_get_unix_pid(creds, error) \ - ({ \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - (g_credentials_get_unix_pid) ((creds), (error)); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - }) -#else -#define g_credentials_get_unix_pid(creds, error) \ - ({ \ - struct ucred *native_creds; \ - \ - native_creds = g_credentials_get_native ((creds), G_CREDENTIALS_TYPE_LINUX_UCRED); \ - g_assert (native_creds); \ - native_creds->pid; \ - }) -#endif - - -#if !GLIB_CHECK_VERSION(2, 40, 0) || defined (NM_GLIB_COMPAT_H_TEST) -static inline gpointer * -_nm_g_hash_table_get_keys_as_array (GHashTable *hash_table, - guint *length) -{ - GHashTableIter iter; - gpointer key, *ret; - guint i = 0; - - g_return_val_if_fail (hash_table, NULL); - - ret = g_new0 (gpointer, g_hash_table_size (hash_table) + 1); - g_hash_table_iter_init (&iter, hash_table); - - while (g_hash_table_iter_next (&iter, &key, NULL)) - ret[i++] = key; - - ret[i] = NULL; - - if (length) - *length = i; - - return ret; -} -#endif -#if !GLIB_CHECK_VERSION(2, 40, 0) -#define g_hash_table_get_keys_as_array(hash_table, length) \ - ({ \ - _nm_g_hash_table_get_keys_as_array (hash_table, length); \ - }) -#else -#define g_hash_table_get_keys_as_array(hash_table, length) \ - ({ \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - (g_hash_table_get_keys_as_array) ((hash_table), (length)); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - }) -#endif - -#ifndef g_info -/* g_info was only added with 2.39.2 */ -#define g_info(...) g_log (G_LOG_DOMAIN, \ - G_LOG_LEVEL_INFO, \ - __VA_ARGS__) -#endif - #if !GLIB_CHECK_VERSION(2, 44, 0) static inline gpointer g_steal_pointer (gpointer pp) @@ -420,67 +109,6 @@ _nm_g_strv_contains (const gchar * const *strv, } #define g_strv_contains _nm_g_strv_contains -static inline GVariant * -_nm_g_variant_new_take_string (gchar *string) -{ -#if !GLIB_CHECK_VERSION(2, 36, 0) - GVariant *value; - - g_return_val_if_fail (string != NULL, NULL); - g_return_val_if_fail (g_utf8_validate (string, -1, NULL), NULL); - - value = g_variant_new_string (string); - g_free (string); - return value; -#elif !GLIB_CHECK_VERSION(2, 38, 0) - GVariant *value; - GBytes *bytes; - - g_return_val_if_fail (string != NULL, NULL); - g_return_val_if_fail (g_utf8_validate (string, -1, NULL), NULL); - - bytes = g_bytes_new_take (string, strlen (string) + 1); - value = g_variant_new_from_bytes (G_VARIANT_TYPE_STRING, bytes, TRUE); - g_bytes_unref (bytes); - - return value; -#else - G_GNUC_BEGIN_IGNORE_DEPRECATIONS - return g_variant_new_take_string (string); - G_GNUC_END_IGNORE_DEPRECATIONS -#endif -} -#define g_variant_new_take_string _nm_g_variant_new_take_string - -#if !GLIB_CHECK_VERSION(2, 38, 0) -_nm_printf (1, 2) -static inline GVariant * -_nm_g_variant_new_printf (const char *format_string, ...) -{ - char *string; - va_list ap; - - g_return_val_if_fail (format_string, NULL); - - va_start (ap, format_string); - string = g_strdup_vprintf (format_string, ap); - va_end (ap); - - return g_variant_new_take_string (string); -} -#define g_variant_new_printf(...) _nm_g_variant_new_printf(__VA_ARGS__) -#else -#define g_variant_new_printf(...) \ - ({ \ - GVariant *_v; \ - \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ - _v = g_variant_new_printf (__VA_ARGS__); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ - _v; \ - }) -#endif - #if !GLIB_CHECK_VERSION (2, 56, 0) #define g_object_ref(Obj) ((typeof(Obj)) g_object_ref (Obj)) #define g_object_ref_sink(Obj) ((typeof(Obj)) g_object_ref_sink (Obj)) diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h index f4f05de760..d47bb87fab 100644 --- a/shared/nm-utils/nm-test-utils.h +++ b/shared/nm-utils/nm-test-utils.h @@ -332,8 +332,6 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ __nmtst_internal.assert_logging = !!assert_logging; - nm_g_type_init (); - is_debug = g_test_verbose (); nmtst_debug = g_getenv ("NMTST_DEBUG"); @@ -540,13 +538,10 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ *out_set_logging = TRUE; #endif g_assert (success); -#if GLIB_CHECK_VERSION(2,34,0) if (__nmtst_internal.no_expect_message) g_log_set_always_fatal (G_LOG_FATAL_MASK); -#else /* g_test_expect_message() is a NOP, so allow any messages */ g_log_set_always_fatal (G_LOG_FATAL_MASK); -#endif } else if (__nmtst_internal.no_expect_message) { /* We have a test that would be assert_logging, but the user specified no_expect_message. * This transforms g_test_expect_message() into a NOP, but we also have to relax @@ -566,14 +561,9 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ } #endif } else { -#if GLIB_CHECK_VERSION(2,34,0) /* We were called not to set logging levels. This means, that the user * expects to assert against (all) messages. Any uncought message is fatal. */ g_log_set_always_fatal (G_LOG_LEVEL_MASK); -#else - /* g_test_expect_message() is a NOP, so allow any messages */ - g_log_set_always_fatal (G_LOG_FATAL_MASK); -#endif } if ((!__nmtst_internal.assert_logging || (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message)) && @@ -640,7 +630,6 @@ nmtst_test_quick (void) return __nmtst_internal.test_quick; } -#if GLIB_CHECK_VERSION(2,34,0) #undef g_test_expect_message #define g_test_expect_message(...) \ G_STMT_START { \ @@ -664,11 +653,8 @@ nmtst_test_quick (void) if (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message) \ g_debug ("nmtst: assert-logging: g_test_assert_expected_messages(%s, %s:%d, %s)", _domain?:"", _file?:"", _line, _func?:""); \ \ - G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ g_test_assert_expected_messages_internal (_domain, _file, _line, _func); \ - G_GNUC_END_IGNORE_DEPRECATIONS \ } G_STMT_END -#endif #define NMTST_EXPECT(domain, level, msg) g_test_expect_message (domain, level, msg) @@ -1739,7 +1725,7 @@ _nmtst_assert_connection_has_settings (NMConnection *connection, gboolean has_at va_start (ap, has_at_most); while ((name = va_arg (ap, const char *))) { - if (!nm_g_hash_table_add (names, (gpointer) name)) + if (!g_hash_table_add (names, (gpointer) name)) g_assert_not_reached (); g_ptr_array_add (names_arr, (gpointer) name); } diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index a3a7be89f5..9b492e449e 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -9331,7 +9331,7 @@ _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, gs_unref_hashtable GHashTable *check_dups = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL); for (i = 0; argv[i]; i++) { - if (!nm_g_hash_table_add (check_dups, (char *) argv[i])) + if (!g_hash_table_add (check_dups, (char *) argv[i])) nm_assert (FALSE); } nm_assert (g_hash_table_size (check_dups) > 0); @@ -12344,7 +12344,7 @@ available_connections_del_all (NMDevice *self) static gboolean available_connections_add (NMDevice *self, NMConnection *connection) { - return nm_g_hash_table_add (self->_priv->available_connections, g_object_ref (connection)); + return g_hash_table_add (self->_priv->available_connections, g_object_ref (connection)); } static gboolean diff --git a/src/dhcp/nm-dhcp-helper.c b/src/dhcp/nm-dhcp-helper.c index f50c5cec02..8ea5506152 100644 --- a/src/dhcp/nm-dhcp-helper.c +++ b/src/dhcp/nm-dhcp-helper.c @@ -134,8 +134,6 @@ main (int argc, char *argv[]) guint try_count = 0; gint64 time_end; - nm_g_type_init (); - /* FIXME: g_dbus_connection_new_for_address_sync() tries to connect to the socket in * non-blocking mode, which can easily fail with EAGAIN, causing the creation of the * socket to fail with "Could not connect: Resource temporarily unavailable". diff --git a/src/main.c b/src/main.c index 6984d52dda..896e39d644 100644 --- a/src/main.c +++ b/src/main.c @@ -232,8 +232,6 @@ main (int argc, char *argv[]) NMConfigCmdLineOptions *config_cli; guint sd_id = 0; - nm_g_type_init (); - /* Known to cause a possible deadlock upon GDBus initialization: * https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure (G_TYPE_SOCKET); diff --git a/src/nm-bus-manager.c b/src/nm-bus-manager.c index 746d1dcbe8..3ad2131c30 100644 --- a/src/nm-bus-manager.c +++ b/src/nm-bus-manager.c @@ -835,10 +835,8 @@ nm_bus_manager_register_object (NMBusManager *self, priv = NM_BUS_MANAGER_GET_PRIVATE (self); #if NM_MORE_ASSERTS >= 1 -#if GLIB_CHECK_VERSION(2,34,0) if (g_dbus_object_manager_server_is_exported (priv->obj_manager, object)) g_return_if_reached (); -#endif #endif g_dbus_object_manager_server_export (priv->obj_manager, object); @@ -866,10 +864,8 @@ nm_bus_manager_unregister_object (NMBusManager *self, priv = NM_BUS_MANAGER_GET_PRIVATE (self); #if NM_MORE_ASSERTS >= 1 -#if GLIB_CHECK_VERSION(2,34,0) if (!g_dbus_object_manager_server_is_exported (priv->obj_manager, object)) g_return_if_reached (); -#endif #endif g_object_get (G_OBJECT (object), "g-object-path", &path, NULL); diff --git a/src/nm-checkpoint-manager.c b/src/nm-checkpoint-manager.c index 0d963ae66a..fd1d41b4b5 100644 --- a/src/nm-checkpoint-manager.c +++ b/src/nm-checkpoint-manager.c @@ -237,9 +237,7 @@ nm_checkpoint_manager_create (NMCheckpointManager *self, item->checkpoint = checkpoint; c_list_link_tail (&self->list, &item->list); - if (!nm_g_hash_table_insert (self->checkpoints, - (gpointer) checkpoint_path, - item)) + if (!g_hash_table_insert (self->checkpoints, (gpointer) checkpoint_path, item)) g_return_val_if_reached (NULL); notify_checkpoints (self); diff --git a/src/nm-config.c b/src/nm-config.c index 3b011fdd1b..118a50ca72 100644 --- a/src/nm-config.c +++ b/src/nm-config.c @@ -2113,7 +2113,7 @@ nm_config_device_state_load_all (void) if (!state) continue; - if (!nm_g_hash_table_insert (states, GINT_TO_POINTER (ifindex), state)) + if (!g_hash_table_insert (states, GINT_TO_POINTER (ifindex), state)) nm_assert_not_reached (); } g_dir_close (dir); diff --git a/src/nm-iface-helper.c b/src/nm-iface-helper.c index 1493ef1974..a7769ab3cd 100644 --- a/src/nm-iface-helper.c +++ b/src/nm-iface-helper.c @@ -347,8 +347,6 @@ main (int argc, char *argv[]) guint sd_id; char sysctl_path_buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE]; - nm_g_type_init (); - setpgid (getpid (), getpid ()); if (!do_early_setup (&argc, &argv)) diff --git a/src/nm-manager.c b/src/nm-manager.c index e124c4646a..6674954f56 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -435,10 +435,10 @@ _device_route_metric_get (NMManager *self, * hence we skip it. */ continue; } - if (!nm_g_hash_table_add (priv->device_route_metrics, - _device_route_metric_data_new (device_state->ifindex, - device_state->route_metric_default_aspired, - device_state->route_metric_default_effective))) + if (!g_hash_table_add (priv->device_route_metrics, + _device_route_metric_data_new (device_state->ifindex, + device_state->route_metric_default_aspired, + device_state->route_metric_default_effective))) nm_assert_not_reached (); } } @@ -531,7 +531,7 @@ again: _LOGT (LOGD_DEVICE, "default-route-metric: ifindex %d reserves metric %u (aspired %u)", data->ifindex, data->effective_metric, data->aspired_metric); - if (!nm_g_hash_table_add (priv->device_route_metrics, data)) + if (!g_hash_table_add (priv->device_route_metrics, data)) nm_assert_not_reached (); out: diff --git a/src/nm-policy.c b/src/nm-policy.c index 9af731aaf5..3f1516a823 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1268,7 +1268,7 @@ auto_activate_device (NMPolicy *self, * activation fails in early stages without changing device * state. */ - if (nm_g_hash_table_add (priv->pending_active_connections, ac)) { + if (g_hash_table_add (priv->pending_active_connections, ac)) { g_signal_connect (ac, NM_ACTIVE_CONNECTION_STATE_CHANGED, G_CALLBACK (pending_ac_state_changed), g_object_ref (self)); g_object_weak_ref (G_OBJECT (ac), (GWeakNotify) pending_ac_gone, self); @@ -2000,7 +2000,7 @@ device_added (NMManager *manager, NMDevice *device, gpointer user_data) priv = NM_POLICY_GET_PRIVATE (self); - if (!nm_g_hash_table_add (priv->devices, device)) + if (!g_hash_table_add (priv->devices, device)) g_return_if_reached (); devices_list_register (self, device); diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index d2c0be2851..399de4a743 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -601,7 +601,7 @@ nm_platform_link_get_all (NMPlatform *self, gboolean sort_by_name) for (i = 0; i < links->len; i++) { item = NMP_OBJECT_CAST_LINK (links->pdata[i]); nm_assert (item->ifindex > 0); - if (!nm_g_hash_table_insert (unseen, GINT_TO_POINTER (item->ifindex), NULL)) + if (!g_hash_table_insert (unseen, GINT_TO_POINTER (item->ifindex), NULL)) nm_assert_not_reached (); } @@ -3338,7 +3338,7 @@ nm_platform_ip4_address_sync (NMPlatform *self, known_addresses_idx = g_hash_table_new ((GHashFunc) nmp_object_id_hash, (GEqualFunc) nmp_object_id_equal); } - if (!nm_g_hash_table_insert (known_addresses_idx, (gpointer) o, (gpointer) o)) { + if (!g_hash_table_insert (known_addresses_idx, (gpointer) o, (gpointer) o)) { /* duplicate? Keep only the first instance. */ goto delete_and_next; } @@ -3750,7 +3750,7 @@ nm_platform_ip_route_sync (NMPlatform *self, routes_idx = g_hash_table_new ((GHashFunc) nmp_object_id_hash, (GEqualFunc) nmp_object_id_equal); } - if (!nm_g_hash_table_insert (routes_idx, (gpointer) conf_o, (gpointer) conf_o)) { + if (!g_hash_table_insert (routes_idx, (gpointer) conf_o, (gpointer) conf_o)) { _LOGD ("route-sync: skip adding duplicate route %s", nmp_object_to_string (conf_o, NMP_OBJECT_TO_STRING_PUBLIC, sbuf1, sizeof (sbuf1))); continue; diff --git a/src/ppp/nm-pppd-plugin.c b/src/ppp/nm-pppd-plugin.c index c5496e6622..e3df26ef08 100644 --- a/src/ppp/nm-pppd-plugin.c +++ b/src/ppp/nm-pppd-plugin.c @@ -402,8 +402,6 @@ plugin_init (void) GDBusConnection *bus; GError *err = NULL; - nm_g_type_init (); - g_message ("nm-ppp-plugin: (%s): initializing", __func__); bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &err);