summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2013-01-21 17:07:12 -0500
committerCosimo Cecchi <cosimoc@gnome.org>2013-01-21 17:07:12 -0500
commit7fa38fd6fb700aaca5f8d46401452a7cae85a169 (patch)
treefce9ea04c57bd099eaee69992196223ba9da934f
parenta97a5d30492f793a082269e1ad12cb6d31766aa8 (diff)
downloadgtk+-7fa38fd6fb700aaca5f8d46401452a7cae85a169.tar.gz
Use g_clear_object()
-rw-r--r--gtk/gtkplacessidebar.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index c516b4c813..d8724cd1a0 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -1737,21 +1737,11 @@ get_selection_info (GtkPlacesSidebar *sidebar, SelectionInfo *info)
static void
free_selection_info (SelectionInfo *info)
{
- if (info->drive)
- g_object_unref (info->drive);
+ g_clear_object (&info->drive);
+ g_clear_object (&info->volume);
+ g_clear_object (&info->mount);
- if (info->volume)
- g_object_unref (info->volume);
-
- if (info->mount)
- g_object_unref (info->mount);
-
- g_free (info->uri);
-
- info->drive = NULL;
- info->volume = NULL;
- info->mount = NULL;
- info->uri = NULL;
+ g_clear_pointer (&info->uri, g_free);
}
typedef struct {
@@ -1951,10 +1941,8 @@ open_selected_bookmark (GtkPlacesSidebar *sidebar,
g_object_unref (mount_op);
}
- if (drive != NULL)
- g_object_unref (drive);
- if (volume != NULL)
- g_object_unref (volume);
+ g_clear_object (&drive);
+ g_clear_object (&volume);
}
}
@@ -2422,12 +2410,9 @@ eject_or_unmount_bookmark (GtkPlacesSidebar *sidebar,
ret = TRUE;
}
- if (mount != NULL)
- g_object_unref (mount);
- if (volume != NULL)
- g_object_unref (volume);
- if (drive != NULL)
- g_object_unref (drive);
+ g_clear_object (&mount);
+ g_clear_object (&volume);
+ g_clear_object (&drive);
return ret;
}