From ad7e809d4d811bead43de58e5041f8d136c88df6 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 10 Oct 2013 16:02:05 +0200 Subject: lib: Simplify _new() functions No need to use a temporary variable. --- libupower-glib/up-device.c | 4 +--- libupower-glib/up-history-item.c | 4 +--- libupower-glib/up-stats-item.c | 4 +--- libupower-glib/up-wakeup-item.c | 4 +--- libupower-glib/up-wakeups.c | 4 +--- 5 files changed, 5 insertions(+), 15 deletions(-) (limited to 'libupower-glib') diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 31db5ec..72cf530 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -1419,8 +1419,6 @@ up_device_finalize (GObject *object) UpDevice * up_device_new (void) { - UpDevice *device; - device = g_object_new (UP_TYPE_DEVICE, NULL); - return UP_DEVICE (device); + return UP_DEVICE (g_object_new (UP_TYPE_DEVICE, NULL)); } diff --git a/libupower-glib/up-history-item.c b/libupower-glib/up-history-item.c index 082b408..e158e1a 100644 --- a/libupower-glib/up-history-item.c +++ b/libupower-glib/up-history-item.c @@ -358,8 +358,6 @@ up_history_item_finalize (GObject *object) UpHistoryItem * up_history_item_new (void) { - UpHistoryItem *history_item; - history_item = g_object_new (UP_TYPE_HISTORY_ITEM, NULL); - return UP_HISTORY_ITEM (history_item); + return UP_HISTORY_ITEM (g_object_new (UP_TYPE_HISTORY_ITEM, NULL)); } diff --git a/libupower-glib/up-stats-item.c b/libupower-glib/up-stats-item.c index 89b319c..859ed71 100644 --- a/libupower-glib/up-stats-item.c +++ b/libupower-glib/up-stats-item.c @@ -231,8 +231,6 @@ up_stats_item_finalize (GObject *object) UpStatsItem * up_stats_item_new (void) { - UpStatsItem *stats_item; - stats_item = g_object_new (UP_TYPE_STATS_ITEM, NULL); - return UP_STATS_ITEM (stats_item); + return UP_STATS_ITEM (g_object_new (UP_TYPE_STATS_ITEM, NULL)); } diff --git a/libupower-glib/up-wakeup-item.c b/libupower-glib/up-wakeup-item.c index 7060a3d..0bdd458 100644 --- a/libupower-glib/up-wakeup-item.c +++ b/libupower-glib/up-wakeup-item.c @@ -458,8 +458,6 @@ up_wakeup_item_finalize (GObject *object) UpWakeupItem * up_wakeup_item_new (void) { - UpWakeupItem *wakeup_item; - wakeup_item = g_object_new (UP_TYPE_WAKEUP_ITEM, NULL); - return UP_WAKEUP_ITEM (wakeup_item); + return UP_WAKEUP_ITEM (g_object_new (UP_TYPE_WAKEUP_ITEM, NULL)); } diff --git a/libupower-glib/up-wakeups.c b/libupower-glib/up-wakeups.c index 20b9f59..e3d3475 100644 --- a/libupower-glib/up-wakeups.c +++ b/libupower-glib/up-wakeups.c @@ -395,8 +395,6 @@ up_wakeups_finalize (GObject *object) UpWakeups * up_wakeups_new (void) { - UpWakeups *wakeups; - wakeups = g_object_new (UP_TYPE_WAKEUPS, NULL); - return UP_WAKEUPS (wakeups); + return UP_WAKEUPS (g_object_new (UP_TYPE_WAKEUPS, NULL)); } -- cgit v1.2.1