diff options
| author | Michael Biebl <biebl@debian.org> | 2016-08-26 02:18:32 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2016-08-26 02:18:32 +0200 |
| commit | 7514efc2f38c9ace4557d4e69d68e7d380389030 (patch) | |
| tree | 7fb00fda86cfcc2ca377f191633a7cfdbfea7ca3 /src/devices/nm-device-ethernet-utils.c | |
| parent | d6201f5d8daada3d64a0a3e0038e14eebec683ce (diff) | |
Imported Upstream version 1.4.0 upstream/1.4.0
Diffstat (limited to 'src/devices/nm-device-ethernet-utils.c')
| -rw-r--r-- | src/devices/nm-device-ethernet-utils.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/devices/nm-device-ethernet-utils.c b/src/devices/nm-device-ethernet-utils.c index d034ddfc..298e6dff 100644 --- a/src/devices/nm-device-ethernet-utils.c +++ b/src/devices/nm-device-ethernet-utils.c @@ -25,30 +25,26 @@ #include "nm-device-ethernet-utils.h" char * -nm_device_ethernet_utils_get_default_wired_name (const GSList *connections) +nm_device_ethernet_utils_get_default_wired_name (NMConnection *const *connections) { - const GSList *iter; - char *cname = NULL; - int i = 0; + char *temp; + guint j; + int i; /* Find the next available unique connection name */ - while (!cname && (i++ < 10000)) { - char *temp; - gboolean found = FALSE; - + for (i = 1; i <= 10000; i++) { temp = g_strdup_printf (_("Wired connection %d"), i); - for (iter = connections; iter; iter = iter->next) { - if (g_strcmp0 (nm_connection_get_id (NM_CONNECTION (iter->data)), temp) == 0) { - found = TRUE; + for (j = 0; connections[j]; j++) { + if (nm_streq0 (nm_connection_get_id (connections[j]), temp)) { g_free (temp); - break; + goto next; } } - - if (found == FALSE) - cname = temp; + return temp; +next: + ; } - return cname; + return NULL; } |