diff options
| author | Michael Biebl <biebl@debian.org> | 2018-10-20 01:30:31 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-10-20 01:30:31 +0200 |
| commit | 6518e361171f64bcaaa4bf868139362ed95cc2e0 (patch) | |
| tree | d2d5b53faf80646a40ec2c0c7f2a42b3959612f5 /src/tests/test-wired-defname.c | |
| parent | e126f3e804c35480c4f075777430419d6ece23da (diff) | |
New upstream version 1.14.2 upstream/1.14.2
Diffstat (limited to 'src/tests/test-wired-defname.c')
| -rw-r--r-- | src/tests/test-wired-defname.c | 17 |
1 files changed, 8 insertions, 9 deletions
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); } /*****************************************************************************/ |