summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-10 16:02:05 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-14 10:37:03 +0200
commitad7e809d4d811bead43de58e5041f8d136c88df6 (patch)
tree293f76f88fba560060eaf527872c7c1b9b6ed4d9
parent5f26bc5caa1b1d3ed352702be1fec5d5625ff1d1 (diff)
lib: Simplify _new() functions
No need to use a temporary variable.
-rw-r--r--libupower-glib/up-device.c4
-rw-r--r--libupower-glib/up-history-item.c4
-rw-r--r--libupower-glib/up-stats-item.c4
-rw-r--r--libupower-glib/up-wakeup-item.c4
-rw-r--r--libupower-glib/up-wakeups.c4
5 files changed, 5 insertions, 15 deletions
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));
}