]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Make loops a bit more explicit
authorMichael Terry <michael.terry@canonical.com>
Mon, 25 Nov 2013 21:02:30 +0000 (16:02 -0500)
committerMichael Terry <michael.terry@canonical.com>
Mon, 25 Nov 2013 21:02:30 +0000 (16:02 -0500)
src/lightdm.c

index 2be0a1618476145250676c6a8bb6a7a39f41180e..bf9f72e1469d1fbdb7f8f6d34245d2073527f920 100644 (file)
@@ -193,14 +193,17 @@ display_manager_seat_removed_cb (DisplayManager *display_manager, Seat *seat)
     /* If we have fallback types registered for the seat, let's try them
        before giving up.  This code does not expect a type name to appear twice
        in the type list.  It is a configuration error to do so. */
-    type = seat_get_type_name(seat);
+    type = seat_get_type_name (seat);
     types = seat_get_string_list_property (seat, "type");
-    for (iter = types; !next_seat && iter && *iter; iter++)
+    for (iter = types; iter && *iter; iter++)
     {
-        if (make_seats)
-            next_seat = seat_new (*iter);
-        else if (g_strcmp0 (type, *iter) == 0)
+        if (g_strcmp0 (type, *iter) == 0)
             make_seats = TRUE;
+        else if (make_seats) {
+            next_seat = seat_new (*iter);
+            if (next_seat)
+                break;
+        }
     }
     g_strfreev (types);
 
@@ -1249,8 +1252,12 @@ main (int argc, char **argv)
         types = config_get_string_list (config_get_instance (), config_section, "type");
         if (!types)
             types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
-        for (type = types; !seat && type && *type; type++)
+        for (type = types; type && *type; type++)
+        {
             seat = seat_new (*type);
+            if (seat)
+                break;
+        }
         g_strfreev (types);
         if (seat)
         {
@@ -1279,8 +1286,12 @@ main (int argc, char **argv)
         g_debug ("Adding default seat");
 
         types = config_get_string_list (config_get_instance (), "SeatDefaults", "type");
-        for (type = types; !seat && type && *type; type++)
+        for (type = types; type && *type; type++)
+        {
             seat = seat_new (*type);
+            if (seat)
+                break;
+        }
         g_strfreev (types);
         if (seat)
         {