[gnome-settings-daemon] power: Simplify up_client_get_devices() handling
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Simplify up_client_get_devices() handling
- Date: Fri, 19 Jul 2013 07:39:03 +0000 (UTC)
commit 1c203be1f88bc44b7048448a71acdb7a71ee5aba
Author: Bastien Nocera <hadess hadess net>
Date: Fri Jul 19 09:36:16 2013 +0200
power: Simplify up_client_get_devices() handling
plugins/power/gsd-power-manager.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index fbf24f2..f819e51 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -1011,24 +1011,22 @@ engine_coldplug (GsdPowerManager *manager)
if (!ret) {
g_warning ("failed to get device list: %s", error->message);
g_error_free (error);
- goto out;
+ return FALSE;
}
engine_recalculate_state (manager);
/* add to database */
array = up_client_get_devices (manager->priv->up_client);
- if (array == NULL)
- goto out;
- for (i=0;i<array->len;i++) {
+ for (i = 0 ; array != NULL && i < array->len ; i++) {
device = g_ptr_array_index (array, i);
engine_device_add (manager, device);
engine_check_recall (manager, device);
}
-out:
- if (array != NULL)
- g_ptr_array_unref (array);
+
+ g_clear_pointer (&array, g_ptr_array_unref);
+
/* never repeat */
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]