From 6518e361171f64bcaaa4bf868139362ed95cc2e0 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 20 Oct 2018 01:30:31 +0200 Subject: New upstream version 1.14.2 --- src/tests/test-wired-defname.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/tests/test-wired-defname.c') diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c index a966ed21..97a6c319 100644 --- a/src/tests/test-wired-defname.c +++ b/src/tests/test-wired-defname.c @@ -44,15 +44,14 @@ _new_connection (const char *id) static char * _get_default_wired_name (GSList *list) { - gs_free NMConnection **v = NULL; - guint l, i; - - l = g_slist_length (list); - v = g_new0 (NMConnection *, l + 1); - for (i = 0; list; list = list->next, i++) - v[i] = NM_CONNECTION (list->data); - g_assert (i == l); - return nm_device_ethernet_utils_get_default_wired_name (v); + gs_unref_hashtable GHashTable *existing_ids = NULL; + + if (list) { + existing_ids = g_hash_table_new (nm_str_hash, g_str_equal); + for (; list; list = list->next) + g_hash_table_add (existing_ids, (char *) nm_connection_get_id (list->data)); + } + return nm_device_ethernet_utils_get_default_wired_name (existing_ids); } /*****************************************************************************/ -- cgit 1.3.0-6-gf8a5