[gnome-bluetooth] lib: Use g_clear_* helpers when possible
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Use g_clear_* helpers when possible
- Date: Wed, 4 Sep 2013 01:35:48 +0000 (UTC)
commit d8fd62854e425fe261df92b4980f0f5be4fdafa3
Author: Bastien Nocera <hadess hadess net>
Date: Wed Sep 4 03:34:03 2013 +0200
lib: Use g_clear_* helpers when possible
lib/bluetooth-client.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index e31643c..e4da062 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -800,16 +800,11 @@ bluez_vanished_cb (GDBusConnection *connection,
{
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
- if (priv->default_adapter)
- g_clear_pointer (&priv->default_adapter,
- gtk_tree_row_reference_free);
+ g_clear_pointer (&priv->default_adapter, gtk_tree_row_reference_free);
gtk_tree_store_clear (priv->store);
- if (priv->manager) {
- g_object_unref (priv->manager);
- priv->manager = NULL;
- }
+ g_clear_object (&priv->manager);
}
static void bluetooth_client_init(BluetoothClient *client)
@@ -1092,10 +1087,8 @@ static void bluetooth_client_finalize(GObject *client)
g_bus_unwatch_name (priv->owner_change_id);
- if (priv->manager)
- g_object_unref (priv->manager);
-
- g_object_unref(priv->store);
+ g_clear_object (&priv->manager);
+ g_object_unref (priv->store);
g_clear_pointer (&priv->default_adapter, gtk_tree_row_reference_free);
@@ -1648,8 +1641,7 @@ bluetooth_client_dump_device (GtkTreeModel *model,
g_free (alias);
g_free (address);
g_free (icon);
- if (proxy != NULL)
- g_object_unref (proxy);
+ g_clear_object (&proxy);
g_strfreev (uuids);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]