]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: let's reduce one level of indentation
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Feb 2018 17:33:20 +0000 (18:33 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 26 Feb 2018 17:33:20 +0000 (18:33 +0100)
src/login/logind-session-device.c

index 30e29e122cb38a000c8d1c0c04b27c9f6ba5fd4a..64162f65704802f02c8a1e2627760660b2874a1e 100644 (file)
@@ -455,13 +455,14 @@ void session_device_resume_all(Session *s) {
         assert(s);
 
         HASHMAP_FOREACH(sd, s->devices, i) {
-                if (!sd->active) {
-                        if (session_device_start(sd) < 0)
-                                continue;
-                        if (session_device_save(sd) < 0)
-                                continue;
-                        session_device_notify(sd, SESSION_DEVICE_RESUME);
-                }
+                if (sd->active)
+                        continue;
+
+                if (session_device_start(sd) < 0)
+                        continue;
+                if (session_device_save(sd) < 0)
+                        continue;
+                session_device_notify(sd, SESSION_DEVICE_RESUME);
         }
 }
 
@@ -472,25 +473,27 @@ void session_device_pause_all(Session *s) {
         assert(s);
 
         HASHMAP_FOREACH(sd, s->devices, i) {
-                if (sd->active) {
-                        session_device_stop(sd);
-                        session_device_notify(sd, SESSION_DEVICE_PAUSE);
-                }
+                if (!sd->active)
+                        continue;
+
+                session_device_stop(sd);
+                session_device_notify(sd, SESSION_DEVICE_PAUSE);
         }
 }
 
 unsigned int session_device_try_pause_all(Session *s) {
+        unsigned num_pending = 0;
         SessionDevice *sd;
         Iterator i;
-        unsigned int num_pending = 0;
 
         assert(s);
 
         HASHMAP_FOREACH(sd, s->devices, i) {
-                if (sd->active) {
-                        session_device_notify(sd, SESSION_DEVICE_TRY_PAUSE);
-                        ++num_pending;
-                }
+                if (!sd->active)
+                        continue;
+
+                session_device_notify(sd, SESSION_DEVICE_TRY_PAUSE);
+                num_pending++;
         }
 
         return num_pending;