diff options
| author | Michael Biebl <biebl@debian.org> | 2018-10-30 10:26:10 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-10-30 10:26:10 +0100 |
| commit | bd8ab7e82b1ae4e8899b30a59a7b35ba009344ea (patch) | |
| tree | 83691f38efeef4d5dd7a85c0893fa8a54274728f /src/tests/test-wired-defname.c | |
| parent | c15221a34c0af3a5b2c03dfe80c2a9841acefb03 (diff) | |
| parent | 3cdef184c37fa2c152f8542c6107f8a623735a1c (diff) | |
Merge branch 'master' into stretch-backports
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); } /*****************************************************************************/ |