]> sigrok.org Git - libsigrok.git/commitdiff
serial: Remove unneccesary nesting
authorPeter Stuge <redacted>
Sun, 9 May 2010 21:04:24 +0000 (23:04 +0200)
committerPeter Stuge <redacted>
Sun, 9 May 2010 21:10:23 +0000 (23:10 +0200)
hardware/common/serial.c

index 9ab3169ce03af451a9d3474530eda5fa8ac36895..3395c3e058e7b49203510f27060586a428df0e86 100644 (file)
@@ -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;