summaryrefslogtreecommitdiff
path: root/shared/nm-glib-aux/nm-shared-utils.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-06-26 18:10:17 +0200
committerThomas Haller <thaller@redhat.com>2019-06-26 18:10:17 +0200
commitdd5c88b1cc5e6994f638e8731687c65a58a33767 (patch)
treea0fb372a27bd6623acca3f35b78cda2191be9d2b /shared/nm-glib-aux/nm-shared-utils.c
parente4ce9bd7af6a39677ff1a1380906d18062abb24a (diff)
parent7b6f1c2d90e2ee96bf18ab14863ca4ad5c47d031 (diff)
downloadNetworkManager-dd5c88b1cc5e6994f638e8731687c65a58a33767.tar.gz
settings: merge branch 'th/various-settings-cleanup-3'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/187
Diffstat (limited to 'shared/nm-glib-aux/nm-shared-utils.c')
-rw-r--r--shared/nm-glib-aux/nm-shared-utils.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c
index 49037ed7b4..472a4c484f 100644
--- a/shared/nm-glib-aux/nm-shared-utils.c
+++ b/shared/nm-glib-aux/nm-shared-utils.c
@@ -2282,6 +2282,35 @@ nm_utils_hash_keys_to_array (GHashTable *hash,
return keys;
}
+gboolean
+nm_utils_hashtable_same_keys (const GHashTable *a,
+ const GHashTable *b)
+{
+ GHashTableIter h;
+ const char *k;
+
+ if (a == b)
+ return TRUE;
+ if (!a || !b)
+ return FALSE;
+ if (g_hash_table_size ((GHashTable *) a) != g_hash_table_size ((GHashTable *) b))
+ return FALSE;
+
+ g_hash_table_iter_init (&h, (GHashTable *) a);
+ while (g_hash_table_iter_next (&h, (gpointer) &k, NULL)) {
+ if (!g_hash_table_contains ((GHashTable *) b, k))
+ return FALSE;
+ }
+
+#if NM_MORE_ASSERTS > 5
+ g_hash_table_iter_init (&h, (GHashTable *) b);
+ while (g_hash_table_iter_next (&h, (gpointer) &k, NULL))
+ nm_assert (g_hash_table_contains ((GHashTable *) a, k));
+#endif
+
+ return TRUE;
+}
+
char **
nm_utils_strv_make_deep_copied (const char **strv)
{