[gnome-settings-daemon] power: Avoid doing impossible tests



commit 162a6061f77e176c593577f2d575c0df9249344a
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Sep 17 16:05:31 2013 +0200

    power: Avoid doing impossible tests
    
    We don't need to check 3 times for different values of state
    if we managed to match the first one.

 plugins/power/gsd-power-manager.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index fba14b2..e7b3cb5 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -717,9 +717,9 @@ engine_update_composite_device (GsdPowerManager *manager)
                 /* one of these will be charging or discharging */
                 if (state == UP_DEVICE_STATE_CHARGING)
                         is_charging = TRUE;
-                if (state == UP_DEVICE_STATE_DISCHARGING)
+                else if (state == UP_DEVICE_STATE_DISCHARGING)
                         is_discharging = TRUE;
-                if (state != UP_DEVICE_STATE_FULLY_CHARGED)
+                else if (state != UP_DEVICE_STATE_FULLY_CHARGED)
                         is_fully_charged = FALSE;
 
                 /* sum up composite */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]