diff --git a/Makefile.am b/Makefile.am index 12aff3d666..ee8e4f079a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3192,6 +3192,15 @@ clients_cppflags = \ check_ltlibraries += clients/common/libnmc-base.la clients_common_libnmc_base_la_SOURCES = \ + shared/nm-utils/nm-enum-utils.c \ + shared/nm-utils/nm-enum-utils.h \ + shared/nm-utils/nm-hash-utils.c \ + shared/nm-utils/nm-hash-utils.h \ + shared/nm-utils/nm-random-utils.c \ + shared/nm-utils/nm-random-utils.h \ + shared/nm-utils/nm-shared-utils.c \ + shared/nm-utils/nm-shared-utils.h \ + \ clients/common/nm-secret-agent-simple.c \ clients/common/nm-secret-agent-simple.h \ clients/common/nm-vpn-helpers.c \ @@ -3240,11 +3249,6 @@ EXTRA_LTLIBRARIES += clients/common/libnmc.la endif clients_common_libnmc_la_SOURCES = \ - shared/nm-utils/nm-enum-utils.c \ - shared/nm-utils/nm-enum-utils.h \ - shared/nm-utils/nm-shared-utils.c \ - shared/nm-utils/nm-shared-utils.h \ - \ shared/nm-meta-setting.c \ shared/nm-meta-setting.h \ \ @@ -3426,8 +3430,6 @@ clients_tui_newt_libnmt_newt_a_CPPFLAGS = \ bin_PROGRAMS += clients/tui/nmtui clients_tui_nmtui_SOURCES = \ - shared/nm-utils/nm-shared-utils.c \ - shared/nm-utils/nm-shared-utils.h \ clients/tui/nmtui.c \ clients/tui/nmtui.h \ clients/tui/nmtui-connect.c \ diff --git a/clients/cli/common.c b/clients/cli/common.c index 0f5dff4baf..246b597d56 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -31,6 +31,7 @@ #include #include +#include "nm-utils/nm-hash-utils.h" #include "nm-vpn-helpers.h" #include "nm-client-utils.h" @@ -41,7 +42,7 @@ static char ** _ip_config_get_routes (NMIPConfig *cfg) { - gs_unref_hashtable GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal); + gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal); GPtrArray *ptr_array; char **arr; guint i; diff --git a/clients/cli/connections.c b/clients/cli/connections.c index e518c9aa7c..5ef82a4e48 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -31,6 +31,8 @@ #include #include +#include "nm-utils/nm-hash-utils.h" + #include "nm-client-utils.h" #include "nm-vpn-helpers.h" #include "nm-meta-setting-access.h" @@ -2268,7 +2270,7 @@ parse_passwords (const char *passwd_file, GError **error) char *pwd_spec, *pwd, *prop; const char *setting; - pwds_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + pwds_hash = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); if (!passwd_file) return pwds_hash; diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index 70d78db6f0..ee621ca3bb 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -36,6 +36,8 @@ #include "nm-client-utils.h" +#include "nm-utils/nm-hash-utils.h" + #include "polkit-agent.h" #include "utils.h" #include "common.h" @@ -124,7 +126,7 @@ complete_fields (const char *option, const char *prefix) GHashTable *h; const char *option_with_value[2] = { option, prefix }; - h = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + h = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL); complete_field (h, metagen_ip4_config); complete_field (h, nmc_fields_dhcp4_config); diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index c429f4d41c..4e90c42643 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -25,6 +25,7 @@ #include #include "nm-common-macros.h" +#include "nm-utils/nm-hash-utils.h" #include "nm-utils/nm-enum-utils.h" #include "NetworkManager.h" @@ -188,7 +189,7 @@ _parse_ip_route (int family, } if (!attrs) - attrs = g_hash_table_new (g_str_hash, g_str_equal); + attrs = g_hash_table_new (nm_str_hash, g_str_equal); g_hash_table_iter_init (&iter, tmp_attrs); while (g_hash_table_iter_next (&iter, (gpointer *) &iter_key, (gpointer *) &iter_value)) { @@ -3011,7 +3012,7 @@ _get_fcn_ip_config_routes (ARGS_GET_FCN) for (i = 0; i < num_routes; i++) { gs_free char *attr_str = NULL; gs_strfreev char **attr_names = NULL; - gs_unref_hashtable GHashTable *hash = g_hash_table_new (g_str_hash, g_str_equal); + gs_unref_hashtable GHashTable *hash = g_hash_table_new (nm_str_hash, g_str_equal); int j; route = nm_setting_ip_config_get_route (s_ip, i); diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c index 0faf68a567..c08f7fe244 100644 --- a/clients/common/nm-secret-agent-simple.c +++ b/clients/common/nm-secret-agent-simple.c @@ -33,6 +33,8 @@ #include +#include "nm-utils/nm-hash-utils.h" + #include "NetworkManager.h" #include "nm-vpn-service-plugin.h" @@ -86,7 +88,7 @@ nm_secret_agent_simple_init (NMSecretAgentSimple *agent) { NMSecretAgentSimplePrivate *priv = NM_SECRET_AGENT_SIMPLE_GET_PRIVATE (agent); - priv->requests = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->requests = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, nm_secret_agent_simple_request_free); } @@ -694,7 +696,7 @@ nm_secret_agent_simple_response (NMSecretAgentSimple *self, g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}")); - settings = g_hash_table_new (g_str_hash, g_str_equal); + settings = g_hash_table_new (nm_str_hash, g_str_equal); for (i = 0; i < secrets->len; i++) { NMSecretAgentSimpleSecretReal *secret = secrets->pdata[i]; diff --git a/clients/common/tests/test-general.c b/clients/common/tests/test-general.c index 591bcd98f0..64efd14d2a 100644 --- a/clients/common/tests/test-general.c +++ b/clients/common/tests/test-general.c @@ -21,6 +21,8 @@ #include "NetworkManager.h" +#include "nm-utils/nm-hash-utils.h" + #include "nm-meta-setting-access.h" #include "nm-utils/nm-test-utils.h" @@ -77,7 +79,7 @@ test_client_meta_check (void) g_assert (info->properties_num == NM_PTRARRAY_LEN (info->properties)); if (info->properties_num) { - gs_unref_hashtable GHashTable *property_names = g_hash_table_new (g_str_hash, g_str_equal); + gs_unref_hashtable GHashTable *property_names = g_hash_table_new (nm_str_hash, g_str_equal); g_assert (info->properties); for (p = 0; p < info->properties_num; p++) { diff --git a/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c index afcbd35ebd..6e69a04b8f 100644 --- a/clients/tui/nmt-connect-connection-list.c +++ b/clients/tui/nmt-connect-connection-list.c @@ -30,6 +30,8 @@ #include "NetworkManager.h" +#include "nm-utils/nm-hash-utils.h" + #include "nmtui.h" #include "nmt-connect-connection-list.h" @@ -274,7 +276,7 @@ add_connections_for_aps (NmtConnectDevice *nmtdev, if (!aps->len) return; - seen_ssids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + seen_ssids = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL); for (i = 0; i < aps->len; i++) { ap = aps->pdata[i]; @@ -362,7 +364,7 @@ append_nmt_devices_for_virtual_devices (GSList *nmt_devices, NmtConnectConnection *nmtconn; int sort_order; - devices_by_name = g_hash_table_new (g_str_hash, g_str_equal); + devices_by_name = g_hash_table_new (nm_str_hash, g_str_equal); for (i = 0; i < connections->len; i++) { conn = connections->pdata[i]; diff --git a/src/NetworkManagerUtils.c b/src/NetworkManagerUtils.c index 316f4acf15..b7a2faaa17 100644 --- a/src/NetworkManagerUtils.c +++ b/src/NetworkManagerUtils.c @@ -299,7 +299,7 @@ nm_utils_complete_generic (NMPlatform *platform, } /* Normalize */ - parameters = g_hash_table_new (g_str_hash, g_str_equal); + parameters = g_hash_table_new (nm_str_hash, g_str_equal); g_hash_table_insert (parameters, NM_CONNECTION_NORMALIZE_PARAM_IP6_CONFIG_METHOD, default_enable_ipv6 ? NM_SETTING_IP6_CONFIG_METHOD_AUTO : NM_SETTING_IP6_CONFIG_METHOD_IGNORE); nm_connection_normalize (connection, parameters, NULL, NULL); diff --git a/src/devices/bluetooth/nm-bluez4-adapter.c b/src/devices/bluetooth/nm-bluez4-adapter.c index 131f144cb7..0f19f9981a 100644 --- a/src/devices/bluetooth/nm-bluez4-adapter.c +++ b/src/devices/bluetooth/nm-bluez4-adapter.c @@ -25,6 +25,7 @@ #include #include "nm-dbus-interface.h" +#include "nm-utils/nm-hash-utils.h" #include "nm-bluez-device.h" #include "nm-bluez-common.h" #include "nm-core-internal.h" @@ -340,7 +341,7 @@ nm_bluez4_adapter_init (NMBluez4Adapter *self) { NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self); - priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->devices = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL); } diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c index 8ef28b73dd..1649da248a 100644 --- a/src/devices/bluetooth/nm-bluez5-manager.c +++ b/src/devices/bluetooth/nm-bluez5-manager.c @@ -514,7 +514,7 @@ nm_bluez5_manager_init (NMBluez5Manager *self) bluez_connect (self); - priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->devices = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref); c_list_init (&priv->network_servers); diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index ca30a1e8e7..90a96cda20 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -294,7 +294,7 @@ nm_device_ethernet_init (NMDeviceEthernet *self) priv = G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate); self->_priv = priv; - priv->s390_options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + priv->s390_options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); } static NMDeviceCapabilities diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c index 4e0d7939d4..0d1c601f1e 100644 --- a/src/devices/nm-device-factory.c +++ b/src/devices/nm-device-factory.c @@ -351,7 +351,7 @@ nm_device_factory_manager_load_factories (NMDeviceFactoryManagerFactoryFunc call g_return_if_fail (factories_by_setting == NULL); factories_by_link = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_object_unref); - factories_by_setting = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) factories_list_unref); + factories_by_setting = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, (GDestroyNotify) factories_list_unref); #define _ADD_INTERNAL(get_type_fcn) \ G_STMT_START { \ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index cbb806861f..5ce96cf71a 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -8939,7 +8939,7 @@ _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, #if NM_MORE_ASSERTS > 10 /* Assert that the keys are unique. */ { - gs_unref_hashtable GHashTable *check_dups = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); + 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])) @@ -13989,7 +13989,7 @@ nm_device_init (NMDevice *self) priv->unmanaged_flags = NM_UNMANAGED_PLATFORM_INIT; priv->unmanaged_mask = priv->unmanaged_flags; priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); - priv->ip6_saved_properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); + priv->ip6_saved_properties = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_free); priv->sys_iface_state = NM_DEVICE_SYS_IFACE_STATE_EXTERNAL; priv->v4_commit_first_time = TRUE; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index ebd5317a52..3d9c967747 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -3360,7 +3360,7 @@ nm_device_wifi_init (NMDeviceWifi *self) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); priv->mode = NM_802_11_MODE_INFRA; - priv->aps = g_hash_table_new (g_str_hash, g_str_equal); + priv->aps = g_hash_table_new (nm_str_hash, g_str_equal); } static void diff --git a/src/devices/wwan/nm-modem-manager.c b/src/devices/wwan/nm-modem-manager.c index 3dd9377699..59cd2bca5f 100644 --- a/src/devices/wwan/nm-modem-manager.c +++ b/src/devices/wwan/nm-modem-manager.c @@ -840,7 +840,7 @@ nm_modem_manager_init (NMModemManager *self) { NMModemManagerPrivate *priv = NM_MODEM_MANAGER_GET_PRIVATE (self); - priv->modems = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + priv->modems = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref); priv->main_cancellable = g_cancellable_new (); diff --git a/src/devices/wwan/nm-modem-ofono.c b/src/devices/wwan/nm-modem-ofono.c index 1fe6debcba..8b3fc2e883 100644 --- a/src/devices/wwan/nm-modem-ofono.c +++ b/src/devices/wwan/nm-modem-ofono.c @@ -1147,7 +1147,7 @@ create_connect_properties (NMConnection *connection) const char *str; setting = nm_connection_get_setting_gsm (connection); - properties = g_hash_table_new (g_str_hash, g_str_equal); + properties = g_hash_table_new (nm_str_hash, g_str_equal); str = nm_setting_gsm_get_apn (setting); if (str) diff --git a/src/dhcp/nm-dhcp-client.c b/src/dhcp/nm-dhcp-client.c index e8ff9ff292..20ea092f0d 100644 --- a/src/dhcp/nm-dhcp-client.c +++ b/src/dhcp/nm-dhcp-client.c @@ -772,7 +772,7 @@ nm_dhcp_client_handle_event (gpointer unused, GVariant *value; /* Copy options */ - str_options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + str_options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); g_variant_iter_init (&iter, options); while (g_variant_iter_next (&iter, "{&sv}", &name, &value)) { maybe_add_option (self, str_options, name, value); diff --git a/src/dhcp/nm-dhcp-dhclient-utils.c b/src/dhcp/nm-dhcp-dhclient-utils.c index a82d78733b..e63e6a8696 100644 --- a/src/dhcp/nm-dhcp-dhclient-utils.c +++ b/src/dhcp/nm-dhcp-dhclient-utils.c @@ -739,7 +739,7 @@ nm_dhcp_dhclient_read_lease_ip_configs (NMDedupMultiIndex *multi_idx, g_hash_table_destroy (hash); } - hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + hash = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); } else if (hash && strlen (*line)) add_lease_option (hash, *line); } diff --git a/src/dhcp/nm-dhcp-systemd.c b/src/dhcp/nm-dhcp-systemd.c index c8c90304c8..9b1a44332c 100644 --- a/src/dhcp/nm-dhcp-systemd.c +++ b/src/dhcp/nm-dhcp-systemd.c @@ -525,7 +525,7 @@ bound4_handle (NMDhcpSystemd *self) _LOGD ("lease available"); - options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); + options = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_free); ip4_config = lease_to_ip4_config (nm_dhcp_client_get_multi_idx (NM_DHCP_CLIENT (self)), iface, nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)), @@ -853,7 +853,7 @@ bound6_handle (NMDhcpSystemd *self) _LOGD ("lease available"); - options = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); + options = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_free); ip6_config = lease_to_ip6_config (nm_dhcp_client_get_multi_idx (NM_DHCP_CLIENT (self)), iface, nm_dhcp_client_get_ifindex (NM_DHCP_CLIENT (self)), diff --git a/src/dhcp/tests/test-dhcp-utils.c b/src/dhcp/tests/test-dhcp-utils.c index 1419b2648d..72f3119112 100644 --- a/src/dhcp/tests/test-dhcp-utils.c +++ b/src/dhcp/tests/test-dhcp-utils.c @@ -57,7 +57,7 @@ fill_table (const Option *test_options, GHashTable *table) const Option *opt; if (!table) - table = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); + table = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL); for (opt = test_options; opt->name; opt++) g_hash_table_insert (table, (gpointer) opt->name, (gpointer) opt->value); return table; diff --git a/src/nm-auth-utils.c b/src/nm-auth-utils.c index b8e64ceb9d..f1aff43029 100644 --- a/src/nm-auth-utils.c +++ b/src/nm-auth-utils.c @@ -24,6 +24,7 @@ #include +#include "nm-utils/nm-hash-utils.h" #include "nm-setting-connection.h" #include "nm-auth-subject.h" #include "nm-auth-manager.h" @@ -131,7 +132,7 @@ nm_auth_chain_new_subject (NMAuthSubject *subject, self = g_slice_new0 (NMAuthChain); self->refcount = 1; - self->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, chain_data_free); + self->data = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, chain_data_free); self->done_func = done_func; self->user_data = user_data; self->context = context ? g_object_ref (context) : NULL; diff --git a/src/nm-checkpoint-manager.c b/src/nm-checkpoint-manager.c index 7f9aa398db..033c11cc43 100644 --- a/src/nm-checkpoint-manager.c +++ b/src/nm-checkpoint-manager.c @@ -283,7 +283,7 @@ nm_checkpoint_manager_new (NMManager *manager) * of NMManager shall surpass the lifetime of the NMCheckpointManager * instance. */ self->_manager = manager; - self->checkpoints = g_hash_table_new_full (g_str_hash, g_str_equal, + self->checkpoints = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, checkpoint_destroy); return self; diff --git a/src/nm-checkpoint.c b/src/nm-checkpoint.c index 04f00e899b..2dd76d590f 100644 --- a/src/nm-checkpoint.c +++ b/src/nm-checkpoint.c @@ -506,7 +506,7 @@ nm_checkpoint_new (NMManager *manager, GPtrArray *devices, guint32 rollback_time priv->flags = flags; if (NM_FLAGS_HAS (flags, NM_CHECKPOINT_CREATE_FLAG_DELETE_NEW_CONNECTIONS)) { - priv->connection_uuids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + priv->connection_uuids = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL); for (con = nm_settings_get_connections (nm_settings_get (), NULL); *con; con++) { g_hash_table_add (priv->connection_uuids, g_strdup (nm_settings_connection_get_uuid (*con))); diff --git a/src/nm-config-data.c b/src/nm-config-data.c index de6f62f6d1..2487b6aa62 100644 --- a/src/nm-config-data.c +++ b/src/nm-config-data.c @@ -875,7 +875,7 @@ load_global_dns (GKeyFile *keyfile, gboolean internal) return NULL; conf = g_malloc0 (sizeof (NMGlobalDnsConfig)); - conf->domains = g_hash_table_new_full (g_str_hash, g_str_equal, + conf->domains = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, (GDestroyNotify) global_dns_domain_free); strv = g_key_file_get_string_list (keyfile, group, "searches", NULL, NULL); @@ -1077,7 +1077,7 @@ nm_global_dns_config_from_dbus (const GValue *value, GError **error) } dns_config = g_malloc0 (sizeof (NMGlobalDnsConfig)); - dns_config->domains = g_hash_table_new_full (g_str_hash, g_str_equal, + dns_config->domains = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, (GDestroyNotify) global_dns_domain_free); g_variant_iter_init (&iter, variant); diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c index 0e903b8991..94264caa6e 100644 --- a/src/nm-exported-object.c +++ b/src/nm-exported-object.c @@ -272,7 +272,7 @@ nm_exported_object_class_add_interface (NMExportedObjectClass *object_class, classinfo = g_slice_new (NMExportedObjectClassInfo); classinfo->skeleton_types = NULL; classinfo->methods = g_array_new (FALSE, FALSE, sizeof (NMExportedObjectDBusMethodImpl)); - classinfo->properties = g_hash_table_new (g_str_hash, g_str_equal); + classinfo->properties = g_hash_table_new (nm_str_hash, g_str_equal); g_type_set_qdata (G_TYPE_FROM_CLASS (object_class), nm_exported_object_class_info_quark (), classinfo); } @@ -579,7 +579,7 @@ _create_export_path (NMExportedObjectClass *klass) p = strchr (class_export_path, '%'); if (p) { if (G_UNLIKELY (!prefix_counters)) - prefix_counters = g_hash_table_new (g_str_hash, g_str_equal); + prefix_counters = g_hash_table_new (nm_str_hash, g_str_equal); nm_assert (p[1] == 'l'); nm_assert (p[2] == 'l'); diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c index 9ecfaaa704..de02ebe097 100644 --- a/src/platform/nm-fake-platform.c +++ b/src/platform/nm-fake-platform.c @@ -1358,7 +1358,7 @@ nm_fake_platform_init (NMFakePlatform *fake_platform) { NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (fake_platform); - priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + priv->options = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); priv->links = g_array_new (TRUE, TRUE, sizeof (NMFakePlatformLink)); } diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 3b37ca539e..c40a2c532b 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -3062,7 +3062,7 @@ _log_dbg_sysctl_get_impl (NMPlatform *platform, const char *pathid, const char * if (!priv->sysctl_get_prev_values) { _nm_logging_clear_platform_logging_cache = _nm_logging_clear_platform_logging_cache_impl; sysctl_clear_cache_list = g_slist_prepend (sysctl_clear_cache_list, platform); - priv->sysctl_get_prev_values = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + priv->sysctl_get_prev_values = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free); } else prev_value = g_hash_table_lookup (priv->sysctl_get_prev_values, pathid); diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c index fdc8dd87a9..540059cad9 100644 --- a/src/platform/nmp-object.c +++ b/src/platform/nmp-object.c @@ -321,9 +321,9 @@ _dedup_multi_idx_type_init (DedupMultiIdxType *idx_type, NMPCacheIdType cache_id /*****************************************************************************/ static void -_vlan_xgress_qos_mappings_hash (NMHashState *h, - guint n_map, - const NMVlanQosMapping *map) +_vlan_xgress_qos_mappings_hash_update (guint n_map, + const NMVlanQosMapping *map, + NMHashState *h) { guint i; @@ -817,12 +817,12 @@ _vt_cmd_obj_hash_lnk_vlan (const NMPObject *obj) nm_hash_init (&h, 914932607u); nm_hash_update_uint (&h, nm_platform_lnk_vlan_hash (&obj->lnk_vlan)); - _vlan_xgress_qos_mappings_hash (&h, - obj->_lnk_vlan.n_ingress_qos_map, - obj->_lnk_vlan.ingress_qos_map); - _vlan_xgress_qos_mappings_hash (&h, - obj->_lnk_vlan.n_egress_qos_map, - obj->_lnk_vlan.egress_qos_map); + _vlan_xgress_qos_mappings_hash_update (obj->_lnk_vlan.n_ingress_qos_map, + obj->_lnk_vlan.ingress_qos_map, + &h); + _vlan_xgress_qos_mappings_hash_update (obj->_lnk_vlan.n_egress_qos_map, + obj->_lnk_vlan.egress_qos_map, + &h); return nm_hash_complete (&h); } diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c index 137f40329f..bcd178435f 100644 --- a/src/settings/nm-agent-manager.c +++ b/src/settings/nm-agent-manager.c @@ -1559,7 +1559,7 @@ nm_agent_manager_init (NMAgentManager *self) NMAgentManagerPrivate *priv = NM_AGENT_MANAGER_GET_PRIVATE (self); c_list_init (&priv->requests); - priv->agents = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + priv->agents = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref); } static void diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c index 3ac42b0172..768f55f8cb 100644 --- a/src/settings/nm-settings-connection.c +++ b/src/settings/nm-settings-connection.c @@ -2776,7 +2776,7 @@ nm_settings_connection_init (NMSettingsConnection *self) priv->agent_mgr = g_object_ref (nm_agent_manager_get ()); - priv->seen_bssids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + priv->seen_bssids = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL); priv->autoconnect_retries = AUTOCONNECT_RETRIES_UNSET; diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index d24e797044..10c160cbc8 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -1885,7 +1885,7 @@ nm_settings_init (NMSettings *self) { NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); - priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); + priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref); /* Hold a reference to the agent manager so it stays alive; the only * other holders are NMSettingsConnection objects which are often diff --git a/src/settings/plugins/ibft/nms-ibft-plugin.c b/src/settings/plugins/ibft/nms-ibft-plugin.c index c9069dc74c..9b1f5ccd00 100644 --- a/src/settings/plugins/ibft/nms-ibft-plugin.c +++ b/src/settings/plugins/ibft/nms-ibft-plugin.c @@ -152,7 +152,7 @@ nms_ibft_plugin_init (NMSIbftPlugin *self) { NMSIbftPluginPrivate *priv = NMS_IBFT_PLUGIN_GET_PRIVATE (self); - priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref); } static void diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c index a3092e7126..f51a760d9c 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -461,7 +461,7 @@ _paths_from_connections (GHashTable *connections) { GHashTableIter iter; NMIfcfgConnection *connection; - GHashTable *paths = g_hash_table_new (g_str_hash, g_str_equal); + GHashTable *paths = g_hash_table_new (nm_str_hash, g_str_equal); g_hash_table_iter_init (&iter, connections); while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &connection)) { @@ -991,7 +991,7 @@ settings_plugin_ifcfg_init (SettingsPluginIfcfg *plugin) { SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE ((SettingsPluginIfcfg *) plugin); - priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref); } static void diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index d939d0ee6b..87fefd8db6 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -882,7 +882,7 @@ svGetKeys (shvarFile *s) /* we don't clone the keys. The keys are only valid * until @s gets modified. */ if (!keys) - keys = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL); + keys = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, NULL); g_hash_table_add (keys, (gpointer) line->key); } } diff --git a/src/settings/plugins/ifnet/nms-ifnet-net-parser.c b/src/settings/plugins/ifnet/nms-ifnet-net-parser.c index 0007f9cdd5..d3e4721919 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-net-parser.c +++ b/src/settings/plugins/ifnet/nms-ifnet-net-parser.c @@ -58,7 +58,7 @@ add_new_connection_config (const gchar * type, const gchar * name) /* Return existing connection */ if ((new_conn = g_hash_table_lookup (conn_table, name)) != NULL) return new_conn; - new_conn = g_hash_table_new (g_str_hash, g_str_equal); + new_conn = g_hash_table_new (nm_str_hash, g_str_equal); new_name = g_strdup (name); g_hash_table_insert (new_conn, g_strdup ("name"), new_name); g_hash_table_insert (new_conn, g_strdup ("type"), g_strdup (type)); @@ -302,8 +302,8 @@ ifnet_init (gchar * config_file) net_parser_data_changed = FALSE; - conn_table = g_hash_table_new (g_str_hash, g_str_equal); - global_settings_table = g_hash_table_new (g_str_hash, g_str_equal); + conn_table = g_hash_table_new (nm_str_hash, g_str_equal); + global_settings_table = g_hash_table_new (nm_str_hash, g_str_equal); functions_list = NULL; if (g_file_test (config_file, G_FILE_TEST_IS_REGULAR)) diff --git a/src/settings/plugins/ifnet/nms-ifnet-plugin.c b/src/settings/plugins/ifnet/nms-ifnet-plugin.c index faac258768..802988c19a 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-plugin.c +++ b/src/settings/plugins/ifnet/nms-ifnet-plugin.c @@ -226,7 +226,7 @@ reload_connections (NMSettingsPlugin *config) NM_CONFIG_KEYFILE_GROUP_IFNET, NM_CONFIG_KEYFILE_KEY_IFNET_AUTO_REFRESH, FALSE); - new_connections = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); + new_connections = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref); /* Reread on-disk data and refresh in-memory connections from it */ conn_names = ifnet_get_connection_names (); @@ -444,7 +444,7 @@ init (NMSettingsPlugin *config) nm_log_info (LOGD_SETTINGS, "Initializing!"); - priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref); priv->unmanaged_well_known = !is_managed_plugin (); nm_log_info (LOGD_SETTINGS, "management mode: %s", priv->unmanaged_well_known ? "unmanaged" : "managed"); diff --git a/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c b/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c index 61e4da7cf4..2b62e88659 100644 --- a/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c +++ b/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c @@ -26,6 +26,7 @@ #include #include +#include "nm-utils/nm-hash-utils.h" #include "settings/nm-settings-plugin.h" #include "nms-ifnet-net-parser.h" @@ -270,8 +271,8 @@ wpa_parser_init (const char *wpa_supplicant_conf) gboolean complete = FALSE; wpa_parser_data_changed = FALSE; - wsec_table = g_hash_table_new (g_str_hash, g_str_equal); - wsec_global_table = g_hash_table_new (g_str_hash, g_str_equal); + wsec_table = g_hash_table_new (nm_str_hash, g_str_equal); + wsec_global_table = g_hash_table_new (nm_str_hash, g_str_equal); if (g_file_test (wpa_supplicant_conf, G_FILE_TEST_IS_REGULAR)) channel = @@ -292,7 +293,7 @@ wpa_parser_init (const char *wpa_supplicant_conf) continue; } else { GHashTable *network = - g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_new (nm_str_hash, g_str_equal); do { gchar *quote_start, *quote_end = NULL, *comment; @@ -512,7 +513,7 @@ wpa_add_security (const char *ssid) return TRUE; else { GHashTable *security = - g_hash_table_new (g_str_hash, g_str_equal); + g_hash_table_new (nm_str_hash, g_str_equal); gchar *ssid_i; nm_log_info (LOGD_SETTINGS, "Adding security for %s", ssid); diff --git a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c index 189b6e69cb..b718a3f831 100644 --- a/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c +++ b/src/settings/plugins/ifupdown/nms-ifupdown-plugin.c @@ -338,16 +338,16 @@ init (NMSettingsPlugin *config) const char *block_name; NMIfupdownConnection *connection; - auto_ifaces = g_hash_table_new (g_str_hash, g_str_equal); + auto_ifaces = g_hash_table_new (nm_str_hash, g_str_equal); if(!priv->connections) - priv->connections = g_hash_table_new (g_str_hash, g_str_equal); + priv->connections = g_hash_table_new (nm_str_hash, g_str_equal); if(!priv->kernel_ifaces) - priv->kernel_ifaces = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, _udev_device_unref); + priv->kernel_ifaces = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, _udev_device_unref); if(!priv->eni_ifaces) - priv->eni_ifaces = g_hash_table_new (g_str_hash, g_str_equal); + priv->eni_ifaces = g_hash_table_new (nm_str_hash, g_str_equal); nm_log_info (LOGD_SETTINGS, "init!"); diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c index 4af80142e1..ee4db32048 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c +++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c @@ -378,7 +378,7 @@ _paths_from_connections (GHashTable *connections) { GHashTableIter iter; NMSKeyfileConnection *connection; - GHashTable *paths = g_hash_table_new (g_str_hash, g_str_equal); + GHashTable *paths = g_hash_table_new (nm_str_hash, g_str_equal); g_hash_table_iter_init (&iter, connections); while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &connection)) { @@ -588,7 +588,7 @@ nms_keyfile_plugin_init (NMSKeyfilePlugin *plugin) NMSKeyfilePluginPrivate *priv = NMS_KEYFILE_PLUGIN_GET_PRIVATE (plugin); priv->config = g_object_ref (nm_config_get ()); - priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); + priv->connections = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_object_unref); } static void diff --git a/src/supplicant/nm-supplicant-config.c b/src/supplicant/nm-supplicant-config.c index 71d2f2cc4a..16e7851a08 100644 --- a/src/supplicant/nm-supplicant-config.c +++ b/src/supplicant/nm-supplicant-config.c @@ -88,11 +88,11 @@ nm_supplicant_config_init (NMSupplicantConfig * self) { NMSupplicantConfigPrivate *priv = NM_SUPPLICANT_CONFIG_GET_PRIVATE (self); - priv->config = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->config = g_hash_table_new_full (nm_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) config_option_free); - priv->blobs = g_hash_table_new_full (g_str_hash, g_str_equal, + priv->blobs = g_hash_table_new_full (nm_str_hash, g_str_equal, (GDestroyNotify) g_free, (GDestroyNotify) blob_free); diff --git a/src/supplicant/nm-supplicant-interface.c b/src/supplicant/nm-supplicant-interface.c index 0c6c3f36d1..44f887cb61 100644 --- a/src/supplicant/nm-supplicant-interface.c +++ b/src/supplicant/nm-supplicant-interface.c @@ -1912,7 +1912,7 @@ nm_supplicant_interface_init (NMSupplicantInterface * self) NMSupplicantInterfacePrivate *priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); priv->state = NM_SUPPLICANT_INTERFACE_STATE_INIT; - priv->bss_proxies = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, bss_data_destroy); + priv->bss_proxies = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, bss_data_destroy); } NMSupplicantInterface * diff --git a/src/vpn/nm-vpn-manager.c b/src/vpn/nm-vpn-manager.c index 8e708d125c..d063916873 100644 --- a/src/vpn/nm-vpn-manager.c +++ b/src/vpn/nm-vpn-manager.c @@ -255,7 +255,7 @@ nm_vpn_manager_init (NMVpnManager *self) try_add_plugin (self, info->data); g_slist_free_full (infos, g_object_unref); - priv->active_services = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); + priv->active_services = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL); } static void