summaryrefslogtreecommitdiff
path: root/gtk/gtkbookmarksmanager.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2015-07-31 17:57:04 -0400
committerMatthias Clasen <mclasen@redhat.com>2015-07-31 22:23:35 -0400
commit9f24b54786d8371f77f9ba0c4475ed82b2e0e68f (patch)
tree8ac32783559f12897ce4e5bbc350ed8aab77e67e /gtk/gtkbookmarksmanager.c
parent9dd2645c4a591e154c2e1fe9e6bd5677c56e928a (diff)
downloadgtk+-9f24b54786d8371f77f9ba0c4475ed82b2e0e68f.tar.gz
Code cleanup
Use g_slist_free_full more consistently. This commit just converts the obvious cases where g_slist_forall is directly followed by g_slist_free.
Diffstat (limited to 'gtk/gtkbookmarksmanager.c')
-rw-r--r--gtk/gtkbookmarksmanager.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/gtk/gtkbookmarksmanager.c b/gtk/gtkbookmarksmanager.c
index 968b49c525..7523aed0bb 100644
--- a/gtk/gtkbookmarksmanager.c
+++ b/gtk/gtkbookmarksmanager.c
@@ -31,8 +31,10 @@
#include "gtkfilechooser.h" /* for the GError types */
static void
-_gtk_bookmark_free (GtkBookmark *bookmark)
+_gtk_bookmark_free (gpointer data)
{
+ GtkBookmark *bookmark = data;
+
g_object_unref (bookmark->file);
g_free (bookmark->label);
g_slice_free (GtkBookmark, bookmark);
@@ -197,9 +199,7 @@ bookmarks_file_changed (GFileMonitor *monitor,
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
case G_FILE_MONITOR_EVENT_CREATED:
case G_FILE_MONITOR_EVENT_DELETED:
- g_slist_foreach (manager->bookmarks, (GFunc) _gtk_bookmark_free, NULL);
- g_slist_free (manager->bookmarks);
-
+ g_slist_free_full (manager->bookmarks, _gtk_bookmark_free);
manager->bookmarks = read_bookmarks (file);
gdk_threads_enter ();
@@ -271,11 +271,7 @@ _gtk_bookmarks_manager_free (GtkBookmarksManager *manager)
g_object_unref (manager->bookmarks_monitor);
}
- if (manager->bookmarks)
- {
- g_slist_foreach (manager->bookmarks, (GFunc) _gtk_bookmark_free, NULL);
- g_slist_free (manager->bookmarks);
- }
+ g_slist_free_full (manager->bookmarks, _gtk_bookmark_free);
g_free (manager);
}