From: Peter Stuge Date: Sun, 9 May 2010 21:04:24 +0000 (+0200) Subject: serial: Remove unneccesary nesting X-Git-Tag: libsigrok-0.1.0~504 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=71dda1065642b33d4c82d514bcaf28e2d2b8729c;p=libsigrok.git serial: Remove unneccesary nesting --- diff --git a/hardware/common/serial.c b/hardware/common/serial.c index 9ab3169c..3395c3e0 100644 --- a/hardware/common/serial.c +++ b/hardware/common/serial.c @@ -60,12 +60,11 @@ GSList *list_serial_ports(void) ports = NULL; for (i = 0; serial_port_glob[i]; i++) { - if (!glob(serial_port_glob[i], 0, NULL, &g)) { - for (j = 0; j < g.gl_pathc; j++) - ports = g_slist_append(ports, - strdup(g.gl_pathv[j])); - globfree(&g); - } + if (glob(serial_port_glob[i], 0, NULL, &g)) + continue; + for (j = 0; j < g.gl_pathc; j++) + ports = g_slist_append(ports, strdup(g.gl_pathv[j])); + globfree(&g); } return ports;