diff options
author | Thomas Haller <thaller@redhat.com> | 2017-11-15 16:06:43 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-11-16 11:49:52 +0100 |
commit | 93adadbdcbbccfeafb8523b129f103bb5b23f7d5 (patch) | |
tree | ba659102aeb347cb6c8689713aa15e7e2d052068 | |
parent | b58481b31ec5785d208a7b11df5b05fc50c158e2 (diff) | |
download | NetworkManager-93adadbdcbbccfeafb8523b129f103bb5b23f7d5.tar.gz |
all: use nm_direct_hash() instead of g_direct_hash()
We also do this for libnm, where it causes visible changes
in behavior. But if somebody would rely on the hashing implementation
for hash tables, it would be seriously flawed.
-rw-r--r-- | clients/cli/connections.c | 2 | ||||
-rw-r--r-- | clients/common/tests/test-general.c | 2 | ||||
-rw-r--r-- | libnm/nm-manager.c | 2 | ||||
-rw-r--r-- | src/devices/nm-arping-manager.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device-factory.c | 2 | ||||
-rw-r--r-- | src/devices/nm-device.c | 6 | ||||
-rw-r--r-- | src/dhcp/nm-dhcp-listener.c | 2 | ||||
-rw-r--r-- | src/dhcp/nm-dhcp-manager.c | 2 | ||||
-rw-r--r-- | src/nm-bus-manager.c | 2 | ||||
-rw-r--r-- | src/nm-checkpoint.c | 2 | ||||
-rw-r--r-- | src/nm-dispatcher.c | 2 | ||||
-rw-r--r-- | src/nm-exported-object.c | 2 | ||||
-rw-r--r-- | src/nm-manager.c | 6 | ||||
-rw-r--r-- | src/nm-policy.c | 6 | ||||
-rw-r--r-- | src/nm-session-monitor.c | 2 | ||||
-rw-r--r-- | src/platform/nm-linux-platform.c | 2 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 4 | ||||
-rw-r--r-- | src/settings/nm-inotify-helper.c | 2 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c | 2 | ||||
-rw-r--r-- | src/settings/plugins/keyfile/nms-keyfile-plugin.c | 2 | ||||
-rw-r--r-- | src/tests/test-general-with-expect.c | 2 |
21 files changed, 28 insertions, 28 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 91f96b262c..f34eec8fc9 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -3308,7 +3308,7 @@ _dynamic_options_set (const NMMetaAbstractInfo *abstract_info, PropertyInfFlags v, v2; if (G_UNLIKELY (!cache)) - cache = g_hash_table_new (NULL, NULL); + cache = g_hash_table_new (nm_direct_hash, NULL); if (g_hash_table_lookup_extended (cache, (gpointer) abstract_info, NULL, &p)) v = GPOINTER_TO_UINT (p); diff --git a/clients/common/tests/test-general.c b/clients/common/tests/test-general.c index e6a06ca535..77ff4cea33 100644 --- a/clients/common/tests/test-general.c +++ b/clients/common/tests/test-general.c @@ -102,7 +102,7 @@ test_client_meta_check (void) if (info->valid_parts) { gsize i, l; - gs_unref_hashtable GHashTable *dup = g_hash_table_new (NULL, NULL); + gs_unref_hashtable GHashTable *dup = g_hash_table_new (nm_direct_hash, NULL); l = NM_PTRARRAY_LEN (info->valid_parts); g_assert (l >= 2); diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index dd689895c1..2f00545d9d 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -192,7 +192,7 @@ nm_manager_init (NMManager *manager) priv->state = NM_STATE_UNKNOWN; priv->connectivity = NM_CONNECTIVITY_UNKNOWN; - priv->permissions = g_hash_table_new (NULL, NULL); + priv->permissions = g_hash_table_new (nm_direct_hash, NULL); priv->devices = g_ptr_array_new (); priv->all_devices = g_ptr_array_new (); priv->active_connections = g_ptr_array_new (); diff --git a/src/devices/nm-arping-manager.c b/src/devices/nm-arping-manager.c index 30e1cf1028..eb5b0574e1 100644 --- a/src/devices/nm-arping-manager.c +++ b/src/devices/nm-arping-manager.c @@ -428,7 +428,7 @@ nm_arping_manager_init (NMArpingManager *self) { NMArpingManagerPrivate *priv = NM_ARPING_MANAGER_GET_PRIVATE (self); - priv->addresses = g_hash_table_new_full (NULL, NULL, + priv->addresses = g_hash_table_new_full (nm_direct_hash, NULL, NULL, destroy_address_info); priv->state = STATE_INIT; } diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c index 86af75e643..9bfdd8e099 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_link == NULL); g_return_if_fail (factories_by_setting == NULL); - factories_by_link = g_hash_table_new_full (NULL, NULL, NULL, g_object_unref); + factories_by_link = g_hash_table_new_full (nm_direct_hash, NULL, NULL, g_object_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) \ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 5da88db3d9..be3f760e14 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6217,7 +6217,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection) guint32 count = 0; if (G_UNLIKELY (!shared_ips)) - shared_ips = g_hash_table_new (NULL, NULL); + shared_ips = g_hash_table_new (nm_direct_hash, NULL); else { while (g_hash_table_lookup (shared_ips, GUINT_TO_POINTER (start + count))) { count += ntohl (0x100); @@ -12072,7 +12072,7 @@ nm_device_recheck_available_connections (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE(self); if (g_hash_table_size (priv->available_connections) > 0) { - prune_list = g_hash_table_new (NULL, NULL); + prune_list = g_hash_table_new (nm_direct_hash, NULL); g_hash_table_iter_init (&h_iter, priv->available_connections); while (g_hash_table_iter_next (&h_iter, (gpointer *) &connection, NULL)) g_hash_table_add (prune_list, connection); @@ -14131,7 +14131,7 @@ nm_device_init (NMDevice *self) priv->rfkill_type = RFKILL_TYPE_UNKNOWN; priv->unmanaged_flags = NM_UNMANAGED_PLATFORM_INIT; priv->unmanaged_mask = priv->unmanaged_flags; - priv->available_connections = g_hash_table_new_full (NULL, NULL, g_object_unref, NULL); + priv->available_connections = g_hash_table_new_full (nm_direct_hash, NULL, g_object_unref, NULL); 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; diff --git a/src/dhcp/nm-dhcp-listener.c b/src/dhcp/nm-dhcp-listener.c index a0449816cd..4dda0b5a05 100644 --- a/src/dhcp/nm-dhcp-listener.c +++ b/src/dhcp/nm-dhcp-listener.c @@ -300,7 +300,7 @@ nm_dhcp_listener_init (NMDhcpListener *self) NMDhcpListenerPrivate *priv = NM_DHCP_LISTENER_GET_PRIVATE (self); /* Maps GDBusConnection :: signal-id */ - priv->connections = g_hash_table_new (NULL, NULL); + priv->connections = g_hash_table_new (nm_direct_hash, NULL); priv->dbus_mgr = nm_bus_manager_get (); diff --git a/src/dhcp/nm-dhcp-manager.c b/src/dhcp/nm-dhcp-manager.c index c6f0a24d5d..118950aff9 100644 --- a/src/dhcp/nm-dhcp-manager.c +++ b/src/dhcp/nm-dhcp-manager.c @@ -429,7 +429,7 @@ nm_dhcp_manager_init (NMDhcpManager *self) nm_log_info (LOGD_DHCP, "dhcp-init: Using DHCP client '%s'", client_factory->name); priv->client_factory = client_factory; - priv->clients = g_hash_table_new_full (NULL, NULL, + priv->clients = g_hash_table_new_full (nm_direct_hash, NULL, NULL, (GDestroyNotify) g_object_unref); } diff --git a/src/nm-bus-manager.c b/src/nm-bus-manager.c index d506f9f300..a1aca26136 100644 --- a/src/nm-bus-manager.c +++ b/src/nm-bus-manager.c @@ -307,7 +307,7 @@ private_server_new (const char *path, g_signal_connect (server, "new-connection", G_CALLBACK (private_server_new_connection), s); - s->obj_managers = g_hash_table_new_full (NULL, NULL, + s->obj_managers = g_hash_table_new_full (nm_direct_hash, NULL, (GDestroyNotify) private_server_manager_destroy, g_free); s->manager = manager; diff --git a/src/nm-checkpoint.c b/src/nm-checkpoint.c index 2a2a174909..54b577642e 100644 --- a/src/nm-checkpoint.c +++ b/src/nm-checkpoint.c @@ -466,7 +466,7 @@ nm_checkpoint_init (NMCheckpoint *self) { NMCheckpointPrivate *priv = NM_CHECKPOINT_GET_PRIVATE (self); - priv->devices = g_hash_table_new_full (NULL, NULL, + priv->devices = g_hash_table_new_full (nm_direct_hash, NULL, NULL, device_checkpoint_destroy); } diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index b90176416e..c465adf258 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -345,7 +345,7 @@ static void _ensure_requests (void) { if (G_UNLIKELY (requests == NULL)) { - requests = g_hash_table_new_full (NULL, + requests = g_hash_table_new_full (nm_direct_hash, NULL, NULL, (GDestroyNotify) dispatcher_info_free); diff --git a/src/nm-exported-object.c b/src/nm-exported-object.c index cf28946398..c52a38b700 100644 --- a/src/nm-exported-object.c +++ b/src/nm-exported-object.c @@ -501,7 +501,7 @@ nm_exported_object_create_skeletons (NMExportedObject *self, ifdata->property_changed_signal_id = g_signal_lookup ("properties-changed", G_OBJECT_TYPE (ifdata->interface)); - ifdata->pending_notifies = g_hash_table_new_full (NULL, + ifdata->pending_notifies = g_hash_table_new_full (nm_direct_hash, NULL, NULL, (GDestroyNotify) g_variant_unref); diff --git a/src/nm-manager.c b/src/nm-manager.c index e2e7499f86..1ab6e39e01 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -3016,7 +3016,7 @@ find_slaves (NMManager *manager, s_con = nm_connection_get_setting_connection (NM_CONNECTION (connection)); g_return_val_if_fail (s_con, NULL); - devices = g_hash_table_new (NULL, NULL); + devices = g_hash_table_new (nm_direct_hash, NULL); /* Search through all connections, not only inactive ones, because * even if a slave was already active, it might be deactivated during @@ -5105,7 +5105,7 @@ nm_manager_write_device_state (NMManager *self) gs_unref_hashtable GHashTable *seen_ifindexes = NULL; gint nm_owned; - seen_ifindexes = g_hash_table_new (NULL, NULL); + seen_ifindexes = g_hash_table_new (nm_direct_hash, NULL); for (devices = priv->devices; devices; devices = devices->next) { NMDevice *device = NM_DEVICE (devices->data); @@ -6233,7 +6233,7 @@ nm_manager_init (NMManager *self) priv->timestamp_update_id = g_timeout_add_seconds (300, (GSourceFunc) periodic_update_active_connection_timestamps, self); priv->metered = NM_METERED_UNKNOWN; - priv->sleep_devices = g_hash_table_new (NULL, NULL); + priv->sleep_devices = g_hash_table_new (nm_direct_hash, NULL); } static gboolean diff --git a/src/nm-policy.c b/src/nm-policy.c index 17bbfbd621..7353d635af 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -333,7 +333,7 @@ device_ip6_prefix_delegated (NMDevice *device, /* Allocate a delegation delegation for new prefix. */ g_array_set_size (priv->ip6_prefix_delegations, i + 1); delegation = &g_array_index (priv->ip6_prefix_delegations, IP6PrefixDelegation, i); - delegation->subnets = g_hash_table_new (NULL, NULL); + delegation->subnets = g_hash_table_new (nm_direct_hash, NULL); delegation->next_subnet = 0; } @@ -2484,8 +2484,8 @@ nm_policy_init (NMPolicy *self) else /* default - full mode */ priv->hostname_mode = NM_POLICY_HOSTNAME_MODE_FULL; - priv->devices = g_hash_table_new (NULL, NULL); - priv->pending_active_connections = g_hash_table_new (NULL, NULL); + priv->devices = g_hash_table_new (nm_direct_hash, NULL); + priv->pending_active_connections = g_hash_table_new (nm_direct_hash, NULL); priv->ip6_prefix_delegations = g_array_new (FALSE, FALSE, sizeof (IP6PrefixDelegation)); g_array_set_clear_func (priv->ip6_prefix_delegations, clear_ip6_prefix_delegation); } diff --git a/src/nm-session-monitor.c b/src/nm-session-monitor.c index 045c29af4c..bbf27acdbb 100644 --- a/src/nm-session-monitor.c +++ b/src/nm-session-monitor.c @@ -258,7 +258,7 @@ ck_init (NMSessionMonitor *monitor) if (g_file_query_exists (file, NULL)) { if ((monitor->ck.monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, &error))) { - monitor->ck.cache = g_hash_table_new_full (NULL, NULL, NULL, g_free); + monitor->ck.cache = g_hash_table_new_full (nm_direct_hash, NULL, NULL, g_free); g_signal_connect (monitor->ck.monitor, "changed", G_CALLBACK (ck_changed), diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c index 359c3baf3a..0e7d74e270 100644 --- a/src/platform/nm-linux-platform.c +++ b/src/platform/nm-linux-platform.c @@ -6696,7 +6696,7 @@ nm_linux_platform_init (NMLinuxPlatform *self) priv->delayed_action.list_master_connected = g_ptr_array_new (); priv->delayed_action.list_refresh_link = g_ptr_array_new (); priv->delayed_action.list_wait_for_nl_response = g_array_new (FALSE, TRUE, sizeof (DelayedActionWaitForNlResponseData)); - priv->wifi_data = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) wifi_utils_deinit); + priv->wifi_data = g_hash_table_new_full (nm_direct_hash, NULL, NULL, (GDestroyNotify) wifi_utils_deinit); } static void diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index d6332648e4..f61355a084 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -594,7 +594,7 @@ nm_platform_link_get_all (NMPlatform *self, gboolean sort_by_name) * further by moving children/slaves to the end. */ g_ptr_array_sort_with_data (links, _link_get_all_presort, GINT_TO_POINTER (sort_by_name)); - unseen = g_hash_table_new (NULL, NULL); + unseen = g_hash_table_new (nm_direct_hash, NULL); for (i = 0; i < links->len; i++) { item = NMP_OBJECT_CAST_LINK (links->pdata[i]); nm_assert (item->ifindex > 0); @@ -3175,7 +3175,7 @@ ip4_addr_subnets_build_index (const GPtrArray *addresses, nm_assert (addresses && addresses->len); - subnets = g_hash_table_new (NULL, NULL); + subnets = g_hash_table_new (nm_direct_hash, NULL); /* Build a hash table of all addresses per subnet */ for (i = 0; i < addresses->len; i++) { diff --git a/src/settings/nm-inotify-helper.c b/src/settings/nm-inotify-helper.c index 5d190b11a9..51b180b233 100644 --- a/src/settings/nm-inotify-helper.c +++ b/src/settings/nm-inotify-helper.c @@ -172,7 +172,7 @@ nm_inotify_helper_init (NMInotifyHelper *self) { NMInotifyHelperPrivate *priv = NM_INOTIFY_HELPER_GET_PRIVATE (self); - priv->wd_refs = g_hash_table_new (NULL, NULL); + priv->wd_refs = g_hash_table_new (nm_direct_hash, NULL); } 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 da0920ef7c..1ebdeafa7f 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c @@ -515,7 +515,7 @@ read_connections (SettingsPluginIfcfg *plugin) return; } - alive_connections = g_hash_table_new (NULL, NULL); + alive_connections = g_hash_table_new (nm_direct_hash, NULL); filenames = g_ptr_array_new_with_free_func (g_free); while ((item = g_dir_read_name (dir))) { diff --git a/src/settings/plugins/keyfile/nms-keyfile-plugin.c b/src/settings/plugins/keyfile/nms-keyfile-plugin.c index ee4db32048..dfc311af33 100644 --- a/src/settings/plugins/keyfile/nms-keyfile-plugin.c +++ b/src/settings/plugins/keyfile/nms-keyfile-plugin.c @@ -435,7 +435,7 @@ read_connections (NMSettingsPlugin *config) return; } - alive_connections = g_hash_table_new (NULL, NULL); + alive_connections = g_hash_table_new (nm_direct_hash, NULL); filenames = g_ptr_array_new_with_free_func (g_free); while ((item = g_dir_read_name (dir))) { diff --git a/src/tests/test-general-with-expect.c b/src/tests/test-general-with-expect.c index 2911d84d6e..5bbe5a25c5 100644 --- a/src/tests/test-general-with-expect.c +++ b/src/tests/test-general-with-expect.c @@ -432,7 +432,7 @@ test_nm_utils_array_remove_at_indexes (void) idx = g_array_new (FALSE, FALSE, sizeof (guint)); array = g_array_new (FALSE, FALSE, sizeof (gssize)); - unique = g_hash_table_new (NULL, NULL); + unique = g_hash_table_new (nm_direct_hash, NULL); for (i_len = 1; i_len < 20; i_len++) { for (i_idx_len = 1; i_idx_len <= i_len; i_idx_len++) { for (i_rnd = 0; i_rnd < 20; i_rnd++) { |