summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-16 11:52:06 +0100
committerThomas Haller <thaller@redhat.com>2017-11-16 11:52:06 +0100
commit27089f475902f5b2cd9a36efb1630b2186551554 (patch)
tree57fec9e40e38a20c91f09b874cdb51d7308f9490
parent30f679c444b7930fec7df48e158285a3053325a6 (diff)
parentac95f7da0bdf46f1ebce6ef3d5afa4beeec094d8 (diff)
downloadNetworkManager-27089f475902f5b2cd9a36efb1630b2186551554.tar.gz
all: merge branch 'th/nm-hash-all'
https://github.com/NetworkManager/NetworkManager/pull/36
-rw-r--r--Makefile.am6
-rw-r--r--clients/cli/common.c1
-rw-r--r--clients/cli/connections.c4
-rw-r--r--clients/cli/nmcli.c2
-rw-r--r--clients/common/nm-meta-setting-desc.c1
-rw-r--r--clients/common/nm-secret-agent-simple.c2
-rw-r--r--clients/common/tests/test-general.c4
-rw-r--r--clients/tui/nmt-connect-connection-list.c2
-rw-r--r--libnm-core/nm-connection.c6
-rw-r--r--libnm-core/nm-keyfile-reader.c2
-rw-r--r--libnm-core/nm-setting-bond.c2
-rw-r--r--libnm-core/nm-setting-ip-config.c4
-rw-r--r--libnm-core/nm-setting-user.c2
-rw-r--r--libnm-core/nm-setting-vpn.c4
-rw-r--r--libnm-core/nm-setting-wired.c2
-rw-r--r--libnm-core/nm-setting.c6
-rw-r--r--libnm-core/nm-utils.c11
-rw-r--r--libnm-core/tests/test-general.c16
-rw-r--r--libnm-glib/nm-client.c2
-rw-r--r--libnm/nm-device.c2
-rw-r--r--libnm/nm-dhcp-config.c2
-rw-r--r--libnm/nm-manager.c4
-rw-r--r--libnm/nm-object.c2
-rw-r--r--libnm/nm-vpn-plugin-old.c4
-rw-r--r--libnm/nm-vpn-service-plugin.c4
-rw-r--r--shared/nm-default.h4
-rw-r--r--shared/nm-utils/nm-hash-utils.c110
-rw-r--r--shared/nm-utils/nm-hash-utils.h2
-rw-r--r--src/devices/bluetooth/nm-bluez4-adapter.c1
-rw-r--r--src/devices/nm-arping-manager.c2
-rw-r--r--src/devices/nm-device-factory.c2
-rw-r--r--src/devices/nm-device.c6
-rw-r--r--src/dhcp/nm-dhcp-listener.c2
-rw-r--r--src/dhcp/nm-dhcp-manager.c2
-rw-r--r--src/nm-auth-utils.c1
-rw-r--r--src/nm-bus-manager.c2
-rw-r--r--src/nm-checkpoint.c2
-rw-r--r--src/nm-core-utils.h2
-rw-r--r--src/nm-dispatcher.c4
-rw-r--r--src/nm-exported-object.c4
-rw-r--r--src/nm-manager.c6
-rw-r--r--src/nm-policy.c6
-rw-r--r--src/nm-session-monitor.c2
-rw-r--r--src/platform/nm-linux-platform.c2
-rw-r--r--src/platform/nm-platform.c4
-rw-r--r--src/settings/nm-inotify-helper.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-plugin.c2
-rw-r--r--src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c1
-rw-r--r--src/settings/plugins/keyfile/nms-keyfile-plugin.c2
-rw-r--r--src/tests/test-general-with-expect.c2
50 files changed, 156 insertions, 116 deletions
diff --git a/Makefile.am b/Makefile.am
index 449f77474a..4a8cd35292 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -460,7 +460,6 @@ libnm_core_lib_c_real = \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-random-utils.c \
shared/nm-utils/nm-udev-utils.c \
- shared/nm-utils/siphash24.c \
shared/nm-meta-setting.c \
libnm-core/crypto.c \
libnm-core/nm-connection.c \
@@ -3131,7 +3130,7 @@ $(src_tests_test_utils_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
src_tests_test_systemd_CPPFLAGS = $(src_libsystemd_nm_la_cppflags)
src_tests_test_systemd_SOURCES = \
- shared/nm-utils/siphash24.c \
+ shared/nm-utils/nm-hash-utils.c \
src/tests/test-systemd.c
src_tests_test_systemd_LDADD = \
src/libsystemd-nm.la \
@@ -3324,7 +3323,6 @@ clients_common_libnmc_base_la_SOURCES = \
shared/nm-utils/nm-random-utils.h \
shared/nm-utils/nm-shared-utils.c \
shared/nm-utils/nm-shared-utils.h \
- shared/nm-utils/siphash24.c \
shared/nm-utils/siphash24.h \
\
clients/common/nm-secret-agent-simple.c \
@@ -4578,6 +4576,8 @@ EXTRA_DIST += \
shared/nm-utils/nm-vpn-plugin-macros.h \
shared/nm-utils/nm-vpn-plugin-utils.c \
shared/nm-utils/nm-vpn-plugin-utils.h \
+ shared/nm-utils/siphash24.c \
+ shared/nm-utils/siphash24.h \
shared/nm-utils/unaligned.h \
shared/nm-version-macros.h.in \
\
diff --git a/clients/cli/common.c b/clients/cli/common.c
index 0f5aea575c..4f369f458b 100644
--- a/clients/cli/common.c
+++ b/clients/cli/common.c
@@ -31,7 +31,6 @@
#include <readline/readline.h>
#include <readline/history.h>
-#include "nm-utils/nm-hash-utils.h"
#include "nm-vpn-helpers.h"
#include "nm-client-utils.h"
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index d85901e6fd..f34eec8fc9 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -31,8 +31,6 @@
#include <readline/readline.h>
#include <readline/history.h>
-#include "nm-utils/nm-hash-utils.h"
-
#include "nm-client-utils.h"
#include "nm-vpn-helpers.h"
#include "nm-meta-setting-access.h"
@@ -3310,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/cli/nmcli.c b/clients/cli/nmcli.c
index ee621ca3bb..b0b31261c0 100644
--- a/clients/cli/nmcli.c
+++ b/clients/cli/nmcli.c
@@ -36,8 +36,6 @@
#include "nm-client-utils.h"
-#include "nm-utils/nm-hash-utils.h"
-
#include "polkit-agent.h"
#include "utils.h"
#include "common.h"
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index 142aab81dd..4835b0fb56 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -25,7 +25,6 @@
#include <arpa/inet.h>
#include "nm-common-macros.h"
-#include "nm-utils/nm-hash-utils.h"
#include "nm-utils/nm-enum-utils.h"
#include "NetworkManager.h"
diff --git a/clients/common/nm-secret-agent-simple.c b/clients/common/nm-secret-agent-simple.c
index 4ef1be239a..21aaf99540 100644
--- a/clients/common/nm-secret-agent-simple.c
+++ b/clients/common/nm-secret-agent-simple.c
@@ -33,8 +33,6 @@
#include <string.h>
-#include "nm-utils/nm-hash-utils.h"
-
#include "NetworkManager.h"
#include "nm-vpn-service-plugin.h"
diff --git a/clients/common/tests/test-general.c b/clients/common/tests/test-general.c
index 64efd14d2a..77ff4cea33 100644
--- a/clients/common/tests/test-general.c
+++ b/clients/common/tests/test-general.c
@@ -21,8 +21,6 @@
#include "NetworkManager.h"
-#include "nm-utils/nm-hash-utils.h"
-
#include "nm-meta-setting-access.h"
#include "nm-utils/nm-test-utils.h"
@@ -104,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/clients/tui/nmt-connect-connection-list.c b/clients/tui/nmt-connect-connection-list.c
index 6e69a04b8f..263bc96c8d 100644
--- a/clients/tui/nmt-connect-connection-list.c
+++ b/clients/tui/nmt-connect-connection-list.c
@@ -30,8 +30,6 @@
#include "NetworkManager.h"
-#include "nm-utils/nm-hash-utils.h"
-
#include "nmtui.h"
#include "nmt-connect-connection-list.h"
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index d5e28f7b3e..5d03295edc 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -587,7 +587,7 @@ nm_connection_diff (NMConnection *a,
if (a == b)
return TRUE;
- diffs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
+ diffs = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
/* Diff A to B, then B to A to capture keys in B that aren't in A */
if (diff_one_connection (a, b, flags, FALSE, diffs))
@@ -1370,7 +1370,7 @@ nm_connection_verify_secrets (NMConnection *connection, GError **error)
* @parameters: (allow-none) (element-type utf8 gpointer): a #GHashTable with
* normalization parameters to allow customization of the normalization by providing
* specific arguments. Unknown arguments will be ignored and the default will be
- * used. The keys must be strings, hashed by g_str_hash() and g_str_equal() functions.
+ * used. The keys must be strings compared with g_str_equal() function.
* The values are opaque and depend on the parameter name.
* @modified: (out) (allow-none): outputs whether any settings were modified.
* @error: location to store error, or %NULL. Contains the reason,
@@ -2716,7 +2716,7 @@ nm_connection_get_private (NMConnection *connection)
priv, (GDestroyNotify) nm_connection_private_free);
priv->self = connection;
- priv->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
+ priv->settings = g_hash_table_new_full (nm_str_hash, g_str_equal, NULL, g_object_unref);
}
return priv;
diff --git a/libnm-core/nm-keyfile-reader.c b/libnm-core/nm-keyfile-reader.c
index 0ac417cdb4..f40fe60f92 100644
--- a/libnm-core/nm-keyfile-reader.c
+++ b/libnm-core/nm-keyfile-reader.c
@@ -763,7 +763,7 @@ read_hash_of_string (GKeyFile *file, NMSetting *setting, const char *key)
if (NM_IS_SETTING_USER (setting)) {
gs_unref_hashtable GHashTable *data = NULL;
- data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ data = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
for (iter = (const char *const*) keys; *iter; iter++) {
gs_free char *to_free = NULL;
char *value = NULL;
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c
index d12940f6f9..e85d1564ea 100644
--- a/libnm-core/nm-setting-bond.c
+++ b/libnm-core/nm-setting-bond.c
@@ -892,7 +892,7 @@ nm_setting_bond_init (NMSettingBond *setting)
{
NMSettingBondPrivate *priv = NM_SETTING_BOND_GET_PRIVATE (setting);
- 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);
/* Default values: */
nm_setting_bond_add_option (setting, NM_SETTING_BOND_OPTION_MODE, "balance-rr");
diff --git a/libnm-core/nm-setting-ip-config.c b/libnm-core/nm-setting-ip-config.c
index 41ae0993f6..33664ae93a 100644
--- a/libnm-core/nm-setting-ip-config.c
+++ b/libnm-core/nm-setting-ip-config.c
@@ -593,7 +593,7 @@ nm_ip_address_set_attribute (NMIPAddress *address, const char *name, GVariant *v
g_return_if_fail (strcmp (name, "address") != 0 && strcmp (name, "prefix") != 0);
if (!address->attributes) {
- address->attributes = g_hash_table_new_full (g_str_hash, g_str_equal,
+ address->attributes = g_hash_table_new_full (nm_str_hash, g_str_equal,
g_free, (GDestroyNotify) g_variant_unref);
}
@@ -1227,7 +1227,7 @@ nm_ip_route_set_attribute (NMIPRoute *route, const char *name, GVariant *value)
&& strcmp (name, "next-hop") != 0 && strcmp (name, "metric") != 0);
if (!route->attributes) {
- route->attributes = g_hash_table_new_full (g_str_hash, g_str_equal,
+ route->attributes = g_hash_table_new_full (nm_str_hash, g_str_equal,
g_free, (GDestroyNotify) g_variant_unref);
}
diff --git a/libnm-core/nm-setting-user.c b/libnm-core/nm-setting-user.c
index 049607e146..526bbd2073 100644
--- a/libnm-core/nm-setting-user.c
+++ b/libnm-core/nm-setting-user.c
@@ -210,7 +210,7 @@ nm_setting_user_check_val (const char *val, GError **error)
static GHashTable *
_create_data_hash (void)
{
- return g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ return g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
}
/**
diff --git a/libnm-core/nm-setting-vpn.c b/libnm-core/nm-setting-vpn.c
index 6b42e0c7a6..343bd9aa30 100644
--- a/libnm-core/nm-setting-vpn.c
+++ b/libnm-core/nm-setting-vpn.c
@@ -722,8 +722,8 @@ nm_setting_vpn_init (NMSettingVpn *setting)
{
NMSettingVpnPrivate *priv = NM_SETTING_VPN_GET_PRIVATE (setting);
- priv->data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- priv->secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, destroy_one_secret);
+ priv->data = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
+ priv->secrets = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, destroy_one_secret);
}
static void
diff --git a/libnm-core/nm-setting-wired.c b/libnm-core/nm-setting-wired.c
index 9d255e1d07..09ed8949d0 100644
--- a/libnm-core/nm-setting-wired.c
+++ b/libnm-core/nm-setting-wired.c
@@ -829,7 +829,7 @@ nm_setting_wired_init (NMSettingWired *setting)
{
NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE (setting);
- 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);
/* We use GArray rather than GPtrArray so it will automatically be NULL-terminated */
priv->mac_address_blacklist = g_array_new (TRUE, FALSE, sizeof (char *));
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index 9c8e53aeac..297887411d 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -95,7 +95,7 @@ _ensure_registered (void)
{
if (G_UNLIKELY (registered_settings == NULL)) {
nm_g_type_init ();
- registered_settings = g_hash_table_new (g_str_hash, g_str_equal);
+ 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);
}
}
@@ -807,7 +807,7 @@ _nm_setting_new_from_dbus (GType setting_type,
GVariant *entry, *entry_key;
char *key;
- keys = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ keys = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
g_variant_iter_init (&iter, setting_dict);
while ((entry = g_variant_iter_next_value (&iter))) {
@@ -1359,7 +1359,7 @@ nm_setting_diff (NMSetting *a,
}
if (*results == NULL) {
- *results = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ *results = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
results_created = TRUE;
}
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c
index a3c363c52a..c3001ab5d1 100644
--- a/libnm-core/nm-utils.c
+++ b/libnm-core/nm-utils.c
@@ -36,7 +36,6 @@
#include "nm-utils/nm-jansson.h"
#include "nm-utils/nm-enum-utils.h"
-#include "nm-utils/nm-hash-utils.h"
#include "nm-common-macros.h"
#include "nm-utils-private.h"
#include "nm-setting-private.h"
@@ -145,7 +144,7 @@ init_lang_to_encodings_hash (void)
if (G_UNLIKELY (langToEncodings5 == NULL)) {
/* Five-letter codes */
enc = (struct IsoLangToEncodings *) &isoLangEntries5[0];
- langToEncodings5 = g_hash_table_new (g_str_hash, g_str_equal);
+ langToEncodings5 = g_hash_table_new (nm_str_hash, g_str_equal);
while (enc->lang) {
g_hash_table_insert (langToEncodings5, (gpointer) enc->lang,
(gpointer) enc->encodings);
@@ -156,7 +155,7 @@ init_lang_to_encodings_hash (void)
if (G_UNLIKELY (langToEncodings2 == NULL)) {
/* Two-letter codes */
enc = (struct IsoLangToEncodings *) &isoLangEntries2[0];
- langToEncodings2 = g_hash_table_new (g_str_hash, g_str_equal);
+ langToEncodings2 = g_hash_table_new (nm_str_hash, g_str_equal);
while (enc->lang) {
g_hash_table_insert (langToEncodings2, (gpointer) enc->lang,
(gpointer) enc->encodings);
@@ -513,7 +512,7 @@ _nm_utils_strdict_from_dbus (GVariant *dbus_value,
const char *key, *value;
GHashTable *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);
g_variant_iter_init (&iter, dbus_value);
while (g_variant_iter_next (&iter, "{&s&s}", &key, &value))
g_hash_table_insert (hash, g_strdup (key), g_strdup (value));
@@ -528,7 +527,7 @@ _nm_utils_copy_strdict (GHashTable *strdict)
GHashTableIter iter;
gpointer key, value;
- copy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ copy = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
if (strdict) {
g_hash_table_iter_init (&iter, strdict);
while (g_hash_table_iter_next (&iter, &key, &value))
@@ -4862,7 +4861,7 @@ nm_utils_parse_variant_attributes (const char *string,
g_return_val_if_fail (key_value_separator, NULL);
g_return_val_if_fail (!error || !*error, NULL);
- ht = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
+ ht = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref);
while (TRUE) {
gs_free char *name = NULL, *value = NULL;
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index 9f134583b3..28724e7fd5 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -26,7 +26,6 @@
#include <string.h>
#include "nm-utils/c-list-util.h"
-#include "nm-utils/nm-hash-utils.h"
#include "nm-utils.h"
#include "nm-setting-private.h"
@@ -168,6 +167,17 @@ _test_hash_str (const char *str)
static void
test_nm_hash (void)
{
+ g_assert (nm_hash_static (0));
+ g_assert (nm_hash_static (777));
+
+ g_assert (nm_hash_str (NULL));
+ g_assert (nm_hash_str (""));
+ g_assert (nm_hash_str ("a"));
+
+ g_assert (nm_hash_ptr (NULL));
+ g_assert (nm_hash_ptr (""));
+ g_assert (nm_hash_ptr ("a"));
+
_test_hash_str ("");
_test_hash_str ("a");
_test_hash_str ("aa");
@@ -6088,7 +6098,7 @@ test_g_ptr_array_insert (void)
static void
test_g_hash_table_get_keys_as_array (void)
{
- GHashTable *table = g_hash_table_new (g_str_hash, g_str_equal);
+ GHashTable *table = g_hash_table_new (nm_str_hash, g_str_equal);
guint length = 0;
char **keys;
@@ -6742,7 +6752,7 @@ test_route_attributes_format (void)
gs_unref_hashtable GHashTable *ht = NULL;
char *str;
- ht = g_hash_table_new_full (g_str_hash, g_str_equal,
+ ht = g_hash_table_new_full (nm_str_hash, g_str_equal,
NULL, (GDestroyNotify) g_variant_unref);
str = nm_utils_format_variant_attributes (NULL, ' ', '=');
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index f14c8e49bc..183cdc933f 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -157,7 +157,7 @@ nm_client_init (NMClient *client)
priv->state = NM_STATE_UNKNOWN;
- priv->permissions = g_hash_table_new (g_direct_hash, g_direct_equal);
+ priv->permissions = g_hash_table_new (NULL, NULL);
}
static void
diff --git a/libnm/nm-device.c b/libnm/nm-device.c
index 65afd078dc..5e4c789394 100644
--- a/libnm/nm-device.c
+++ b/libnm/nm-device.c
@@ -2570,7 +2570,7 @@ nm_lldp_neighbor_new (void)
neigh = g_new0 (NMLldpNeighbor, 1);
neigh->refcount = 1;
- neigh->attrs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
+ neigh->attrs = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free,
(GDestroyNotify) g_variant_unref);
return neigh;
diff --git a/libnm/nm-dhcp-config.c b/libnm/nm-dhcp-config.c
index 3161e2960f..33b99ed04b 100644
--- a/libnm/nm-dhcp-config.c
+++ b/libnm/nm-dhcp-config.c
@@ -51,7 +51,7 @@ nm_dhcp_config_init (NMDhcpConfig *config)
{
NMDhcpConfigPrivate *priv = NM_DHCP_CONFIG_GET_PRIVATE (config);
- 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);
}
static gboolean
diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c
index aa749232be..a8752d682d 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 (g_direct_hash, g_direct_equal);
+ 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 ();
@@ -1458,7 +1458,7 @@ checkpoint_rollback_cb (GObject *object,
&variant,
result,
&error)) {
- hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+ hash = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, NULL);
g_variant_iter_init (&iter, variant);
while (g_variant_iter_next (&iter, "{&su}", &path, &r))
g_hash_table_insert (hash, g_strdup (path), GUINT_TO_POINTER (r));
diff --git a/libnm/nm-object.c b/libnm/nm-object.c
index c344a08dca..8297259d40 100644
--- a/libnm/nm-object.c
+++ b/libnm/nm-object.c
@@ -955,7 +955,7 @@ _nm_object_register_properties (NMObject *object,
G_CALLBACK (properties_changed), object);
g_ptr_array_add (priv->proxies, proxy);
- instance = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ instance = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
priv->property_tables = g_slist_prepend (priv->property_tables, instance);
for (tmp = (NMPropertiesInfo *) info; tmp->name; tmp++) {
diff --git a/libnm/nm-vpn-plugin-old.c b/libnm/nm-vpn-plugin-old.c
index 2b5922b925..1892c394b7 100644
--- a/libnm/nm-vpn-plugin-old.c
+++ b/libnm/nm-vpn-plugin-old.c
@@ -728,8 +728,8 @@ nm_vpn_plugin_old_read_vpn_details (int fd,
if (out_secrets)
g_return_val_if_fail (*out_secrets == NULL, FALSE);
- data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_secret);
+ data = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
+ secrets = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, free_secret);
line = g_string_new (NULL);
diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c
index 31e1295488..79bd0f8193 100644
--- a/libnm/nm-vpn-service-plugin.c
+++ b/libnm/nm-vpn-service-plugin.c
@@ -750,8 +750,8 @@ nm_vpn_service_plugin_read_vpn_details (int fd,
if (out_secrets)
g_return_val_if_fail (*out_secrets == NULL, FALSE);
- data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_secret);
+ data = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
+ secrets = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, free_secret);
line = g_string_new (NULL);
diff --git a/shared/nm-default.h b/shared/nm-default.h
index 9e2377cf80..eb4fbc9e17 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -178,6 +178,10 @@ _nm_g_return_if_fail_warning (const char *log_domain,
#include "nm-utils/nm-macros-internal.h"
#include "nm-utils/nm-shared-utils.h"
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY) == 0
+#include "nm-utils/nm-hash-utils.h"
+#endif
+
#include "nm-version.h"
/*****************************************************************************/
diff --git a/shared/nm-utils/nm-hash-utils.c b/shared/nm-utils/nm-hash-utils.c
index c563140e3a..b096be692c 100644
--- a/shared/nm-utils/nm-hash-utils.c
+++ b/shared/nm-utils/nm-hash-utils.c
@@ -28,6 +28,8 @@
#include "nm-shared-utils.h"
#include "nm-random-utils.h"
+#include "siphash24.c"
+
/*****************************************************************************/
#define HASH_KEY_SIZE 16u
@@ -35,33 +37,77 @@
G_STATIC_ASSERT (sizeof (guint) * HASH_KEY_SIZE_GUINT >= HASH_KEY_SIZE);
+static const guint8 *volatile global_seed = NULL;
+
static const guint8 *
-_get_hash_key (void)
+_get_hash_key_init (void)
{
- static const guint8 *volatile global_seed = NULL;
+ /* the returned hash is aligned to guin64, hence, it is safe
+ * to use it as guint* or guint64* pointer. */
+ static union {
+ guint8 v8[HASH_KEY_SIZE];
+ } g_arr _nm_alignas (guint64);
+ static gsize g_lock;
const guint8 *g;
+ struct siphash siph_state;
+ uint64_t h;
+ guint *p;
g = global_seed;
- if (G_UNLIKELY (g == NULL)) {
- /* the returned hash is aligned to guin64, hence, it is save
- * to use it as guint* or guint64* pointer. */
- static union {
- guint8 v8[HASH_KEY_SIZE];
- } g_arr _nm_alignas (guint64);
- static gsize g_lock;
-
- if (g_once_init_enter (&g_lock)) {
- nm_utils_random_bytes (g_arr.v8, sizeof (g_arr.v8));
- g_atomic_pointer_compare_and_exchange (&global_seed, NULL, g_arr.v8);
- g = g_arr.v8;
- g_once_init_leave (&g_lock, 1);
- } else {
- g = global_seed;
- nm_assert (g);
- }
+ if (G_LIKELY (g != NULL)) {
+ nm_assert (g == g_arr.v8);
+ return g;
+ }
+
+ if (g_once_init_enter (&g_lock)) {
+
+ nm_utils_random_bytes (g_arr.v8, sizeof (g_arr.v8));
+
+ /* use siphash() of the key-size, to mangle the first guint. Otherwise,
+ * the first guint has only the entropy that nm_utils_random_bytes()
+ * generated for the first 4 bytes and relies on a good random generator. */
+ siphash24_init (&siph_state, g_arr.v8);
+ siphash24_compress (g_arr.v8, sizeof (g_arr.v8), &siph_state);
+ h = siphash24_finalize (&siph_state);
+ p = (guint *) g_arr.v8;
+ if (sizeof (guint) < sizeof (h))
+ *p = *p ^ ((guint) (h & 0xFFFFFFFFu)) ^ ((guint) (h >> 32));
+ else
+ *p = *p ^ ((guint) (h & 0xFFFFFFFFu));
+
+ g_atomic_pointer_compare_and_exchange (&global_seed, NULL, g_arr.v8);
+ g_once_init_leave (&g_lock, 1);
}
- return g;
+ nm_assert (global_seed == g_arr.v8);
+ return g_arr.v8;
+}
+
+#define _get_hash_key() \
+ ({ \
+ const guint8 *_g; \
+ \
+ _g = global_seed; \
+ if (G_UNLIKELY (_g == NULL)) \
+ _g = _get_hash_key_init (); \
+ _g; \
+ })
+
+guint
+nm_hash_static (guint static_seed)
+{
+ /* note that we only xor the static_seed with the key.
+ * We don't use siphash24(), which would mix the bits better.
+ * Note that this doesn't matter, because static_seed is not
+ * supposed to be a value that you are hashing (for that, use
+ * full siphash24()).
+ * Instead, different callers may set a different static_seed
+ * so that nm_hash_str(NULL) != nm_hash_ptr(NULL).
+ *
+ * Also, ensure that we don't return zero.
+ */
+ return ((*((const guint *) _get_hash_key ())) ^ static_seed)
+ ?: static_seed ?: 3679500967u;
}
void
@@ -83,11 +129,10 @@ nm_hash_str (const char *str)
{
NMHashState h;
- if (str) {
- nm_hash_init (&h, 1867854211u);
- nm_hash_update_str (&h, str);
- } else
- nm_hash_init (&h, 842995561u);
+ if (!str)
+ return nm_hash_static (1867854211u);
+ nm_hash_init (&h, 1867854211u);
+ nm_hash_update_str (&h, str);
return nm_hash_complete (&h);
}
@@ -100,16 +145,13 @@ nm_str_hash (gconstpointer str)
guint
nm_hash_ptr (gconstpointer ptr)
{
- guint h;
-
- h = ((const guint *) _get_hash_key ())[0];
-
- if (sizeof (ptr) <= sizeof (guint))
- h = h ^ ((guint) ((uintptr_t) ptr));
- else
- h = h ^ ((guint) (((guint64) (uintptr_t) ptr) >> 32)) ^ ((guint) ((uintptr_t) ptr));
+ NMHashState h;
- return h ?: 2907677551u;
+ if (!ptr)
+ return nm_hash_static (2907677551u);
+ nm_hash_init (&h, 2907677551u);
+ nm_hash_update (&h, &ptr, sizeof (ptr));
+ return nm_hash_complete (&h);
}
guint
diff --git a/shared/nm-utils/nm-hash-utils.h b/shared/nm-utils/nm-hash-utils.h
index 276e1ebe02..21396f2814 100644
--- a/shared/nm-utils/nm-hash-utils.h
+++ b/shared/nm-utils/nm-hash-utils.h
@@ -31,6 +31,8 @@ struct _NMHashState {
typedef struct _NMHashState NMHashState;
+guint nm_hash_static (guint static_seed);
+
void nm_hash_init (NMHashState *state, guint static_seed);
static inline guint
diff --git a/src/devices/bluetooth/nm-bluez4-adapter.c b/src/devices/bluetooth/nm-bluez4-adapter.c
index 0f19f9981a..c8ef7a2716 100644
--- a/src/devices/bluetooth/nm-bluez4-adapter.c
+++ b/src/devices/bluetooth/nm-bluez4-adapter.c
@@ -25,7 +25,6 @@
#include <string.h>
#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"
diff --git a/src/devices/nm-arping-manager.c b/src/devices/nm-arping-manager.c
index 51f80e08e4..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 (g_direct_hash, g_direct_equal,
+ 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 97f011c5e9..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 (g_direct_hash, g_direct_equal, 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 81d8884283..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 (g_direct_hash, g_direct_equal);
+ 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 (g_direct_hash, g_direct_equal);
+ 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 (g_direct_hash, g_direct_equal, 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 f5c7c84b76..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 (g_direct_hash, g_direct_equal,
+ priv->clients = g_hash_table_new_full (nm_direct_hash, NULL,
NULL,
(GDestroyNotify) g_object_unref);
}
diff --git a/src/nm-auth-utils.c b/src/nm-auth-utils.c
index f1aff43029..f4279b1dfa 100644
--- a/src/nm-auth-utils.c
+++ b/src/nm-auth-utils.c
@@ -24,7 +24,6 @@
#include <string.h>
-#include "nm-utils/nm-hash-utils.h"
#include "nm-setting-connection.h"
#include "nm-auth-subject.h"
#include "nm-auth-manager.h"
diff --git a/src/nm-bus-manager.c b/src/nm-bus-manager.c
index f6b86e903f..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 (g_direct_hash, g_direct_equal,
+ 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 c3a2e74360..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 (g_direct_hash, g_direct_equal,
+ priv->devices = g_hash_table_new_full (nm_direct_hash, NULL,
NULL, device_checkpoint_destroy);
}
diff --git a/src/nm-core-utils.h b/src/nm-core-utils.h
index cc78472442..7078153e99 100644
--- a/src/nm-core-utils.h
+++ b/src/nm-core-utils.h
@@ -25,8 +25,6 @@
#include <stdio.h>
#include <arpa/inet.h>
-#include "nm-utils/nm-hash-utils.h"
-
#include "nm-connection.h"
/*****************************************************************************/
diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
index 237afdefe7..c465adf258 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -345,8 +345,8 @@ static void
_ensure_requests (void)
{
if (G_UNLIKELY (requests == NULL)) {
- requests = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
+ 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 94264caa6e..c52a38b700 100644
--- a/src/nm-exported-object.c
+++ b/src/nm-exported-object.c
@@ -501,8 +501,8 @@ 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 (g_direct_hash,
- g_direct_equal,
+ 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 06423603b7..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 (g_direct_hash, g_direct_equal);
+ 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 (g_direct_hash, g_direct_equal);
+ 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 20781bd45d..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 (g_direct_hash, g_direct_equal, 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 f94d93e257..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 (g_direct_hash, g_direct_equal);
+ 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 4c65b02da5..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 (g_direct_hash, g_direct_equal);
+ 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/ifnet/nms-ifnet-wpa-parser.c b/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c
index 2b62e88659..9253a2aa10 100644
--- a/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c
+++ b/src/settings/plugins/ifnet/nms-ifnet-wpa-parser.c
@@ -26,7 +26,6 @@
#include <string.h>
#include <stdlib.h>
-#include "nm-utils/nm-hash-utils.h"
#include "settings/nm-settings-plugin.h"
#include "nms-ifnet-net-parser.h"
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++) {