[gitg/gtk3] Use g_(s)list_free_full.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/gtk3] Use g_(s)list_free_full.
- Date: Wed, 9 Feb 2011 10:22:40 +0000 (UTC)
commit 895d65ff2b3a934854586dd1435da7c3bcf6b4ee
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue Feb 8 21:34:24 2011 +0100
Use g_(s)list_free_full.
gitg/gitg-commit-view.c | 9 ++-----
gitg/gitg-repository-dialog.c | 8 ++----
gitg/gitg-revision-changes-panel.c | 7 +-----
gitg/gitg-revision-files-panel.c | 3 +-
gitg/gitg-window.c | 38 +++++++++++------------------------
gitg/gitg.c | 3 +-
libgitg/gitg-lanes.c | 6 +---
libgitg/gitg-repository.c | 3 +-
libgitg/gitg-revision.c | 3 +-
9 files changed, 25 insertions(+), 55 deletions(-)
---
diff --git a/gitg/gitg-commit-view.c b/gitg/gitg-commit-view.c
index d095e99..da7a79d 100644
--- a/gitg/gitg-commit-view.c
+++ b/gitg/gitg-commit-view.c
@@ -369,8 +369,7 @@ get_selected_files(GtkTreeView *tree_view,
}
else
{
- g_list_foreach(items, (GFunc)gtk_tree_path_free, NULL);
- g_list_free(items);
+ g_list_free_full (items, gtk_tree_path_free);
}
if (files)
@@ -421,8 +420,7 @@ check_selection(GtkTreeView *tree_view,
ret = TRUE;
}
- g_list_foreach(paths, (GFunc)gtk_tree_path_free, NULL);
- g_list_free(paths);
+ g_list_free_full (paths, gtk_tree_path_free);
return ret;
}
@@ -1251,8 +1249,7 @@ on_tree_view_drag_data_get (GtkWidget *widget,
g_strfreev(uris);
- g_list_foreach(selected, (GFunc)g_object_unref, NULL);
- g_list_free(selected);
+ g_list_free_full (selected, g_object_unref);
}
static void
diff --git a/gitg/gitg-repository-dialog.c b/gitg/gitg-repository-dialog.c
index 1192119..172a01d 100644
--- a/gitg/gitg-repository-dialog.c
+++ b/gitg/gitg-repository-dialog.c
@@ -157,7 +157,7 @@ gitg_repository_dialog_finalize (GObject *object)
}
g_list_free (copy);
- g_list_foreach (dialog->priv->fetchers, (GFunc)fetch_cleanup, NULL);
+ g_list_free (dialog->priv->fetchers);
G_OBJECT_CLASS (gitg_repository_dialog_parent_class)->finalize (object);
}
@@ -230,8 +230,7 @@ update_fetch (GitgRepositoryDialog *dialog)
dialog->priv->show_fetch = show_fetch;
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
}
static void
@@ -248,8 +247,7 @@ update_sensitivity (GitgRepositoryDialog *dialog)
update_fetch (dialog);
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
}
static void
diff --git a/gitg/gitg-revision-changes-panel.c b/gitg/gitg-revision-changes-panel.c
index 06cada8..8706e57 100644
--- a/gitg/gitg-revision-changes-panel.c
+++ b/gitg/gitg-revision-changes-panel.c
@@ -485,16 +485,11 @@ free_cached_header (gpointer header)
static void
free_cached_headers (GitgRevisionChangesPanel *changes_panel)
{
- g_slist_foreach (changes_panel->priv->cached_headers,
- (GFunc)free_cached_header,
- NULL);
-
- g_slist_free (changes_panel->priv->cached_headers);
+ g_slist_free_full (changes_panel->priv->cached_headers, free_cached_header);
changes_panel->priv->cached_headers = NULL;
}
-
static void
gitg_revision_changes_panel_finalize (GObject *object)
{
diff --git a/gitg/gitg-revision-files-panel.c b/gitg/gitg-revision-files-panel.c
index b2947b8..91885d7 100644
--- a/gitg/gitg-revision-files-panel.c
+++ b/gitg/gitg-revision-files-panel.c
@@ -287,8 +287,7 @@ on_selection_changed (GtkTreeSelection *selection,
path = gtk_tree_path_copy ((GtkTreePath *)rows->data);
}
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
if (!path)
{
diff --git a/gitg/gitg-window.c b/gitg/gitg-window.c
index 67bda63..7825e29 100644
--- a/gitg/gitg-window.c
+++ b/gitg/gitg-window.c
@@ -1091,11 +1091,8 @@ gitg_window_destroy (GtkWidget *widget)
{
gtk_tree_view_set_model (window->priv->tree_view, NULL);
- g_slist_foreach (window->priv->revision_panels, (GFunc)g_object_unref, NULL);
- g_slist_free (window->priv->revision_panels);
-
- g_slist_foreach (window->priv->activatables, (GFunc)g_object_unref, NULL);
- g_slist_free (window->priv->activatables);
+ g_slist_free_full (window->priv->revision_panels, g_object_unref);
+ g_slist_free_full (window->priv->activatables, g_object_unref);
window->priv->revision_panels = NULL;
window->priv->activatables = NULL;
@@ -1645,8 +1642,7 @@ fill_branches_combo (GitgWindow *window)
gtk_combo_box_set_active_iter (window->priv->combo_branches, &active);
}
- g_slist_foreach (refs, (GFunc)gitg_ref_free, NULL);
- g_slist_free (refs);
+ g_slist_free_full (refs, gitg_ref_free);
if (active_from_selection)
{
@@ -2703,8 +2699,7 @@ update_merge_rebase (GitgWindow *window,
}
}
- g_slist_foreach (refs, (GFunc)gitg_ref_free, NULL);
- g_slist_free (refs);
+ g_slist_free_full (refs, gitg_ref_free);
if (gitg_ref_get_ref_type (ref) == GITG_REF_TYPE_BRANCH)
{
@@ -2786,8 +2781,7 @@ has_local_ref (GitgWindow *window,
}
}
- g_slist_foreach (refs, (GFunc)gitg_ref_free, NULL);
- g_slist_free (refs);
+ g_slist_free_full (refs, gitg_ref_free);
return ret;
}
@@ -2946,8 +2940,7 @@ on_cherry_pick_activated (GtkAction *action,
gitg_revision_unref (rev);
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
}
static void
@@ -3032,8 +3025,7 @@ update_cherry_pick (GitgWindow *window)
}
}
- g_slist_foreach (refs, (GFunc)gitg_ref_free, NULL);
- g_slist_free (refs);
+ g_slist_free_full (refs, gitg_ref_free);
}
static gboolean
@@ -3099,8 +3091,7 @@ popup_revision (GitgWindow *window,
gtk_action_set_visible (tag, FALSE);
}
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
if (!show)
{
@@ -3376,9 +3367,7 @@ on_format_patch_response (GtkDialog *dialog,
}
}
- g_list_foreach (info->revisions, (GFunc)gitg_revision_unref, NULL);
- g_list_free (info->revisions);
-
+ g_list_free_full (info->revisions, gitg_revision_unref);
g_slice_free (FormatPatchInfo, info);
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -3463,8 +3452,7 @@ on_revision_format_patch_activate (GtkAction *action,
gtk_widget_show (dialog);
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
}
void
@@ -3507,8 +3495,7 @@ on_revision_new_branch_activate (GtkAction *action,
gitg_revision_unref (rev);
}
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
}
void
@@ -3559,8 +3546,7 @@ on_revision_tag_activate (GtkAction *action,
gitg_revision_unref (rev);
}
- g_list_foreach (rows, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, gtk_tree_path_free);
}
void
diff --git a/gitg/gitg.c b/gitg/gitg.c
index 2372a10..54ef19e 100644
--- a/gitg/gitg.c
+++ b/gitg/gitg.c
@@ -162,8 +162,7 @@ set_icons ()
gtk_window_set_default_icon_list (icons);
- g_list_foreach (icons, (GFunc)g_object_unref, NULL);
- g_list_free (icons);
+ g_list_free_full (icons, g_object_unref);
}
int
diff --git a/libgitg/gitg-lanes.c b/libgitg/gitg-lanes.c
index 2a1903a..c059638 100644
--- a/libgitg/gitg-lanes.c
+++ b/libgitg/gitg-lanes.c
@@ -101,8 +101,7 @@ collapsed_lane_new (LaneContainer *container)
static void
free_lanes (GitgLanes *lanes)
{
- g_slist_foreach (lanes->priv->lanes, (GFunc)lane_container_free, NULL);
- g_slist_free (lanes->priv->lanes);
+ g_slist_free_full (lanes->priv->lanes, lane_container_free);
lanes->priv->lanes = NULL;
}
@@ -316,8 +315,7 @@ gitg_lanes_reset (GitgLanes *lanes)
free_lanes (lanes);
gitg_color_reset ();
- g_slist_foreach (lanes->priv->previous, (GFunc)gitg_revision_unref, NULL);
- g_slist_free (lanes->priv->previous);
+ g_slist_free_full (lanes->priv->previous, gitg_revision_unref);
lanes->priv->previous = NULL;
diff --git a/libgitg/gitg-repository.c b/libgitg/gitg-repository.c
index 4f7db71..15fb14c 100644
--- a/libgitg/gitg-repository.c
+++ b/libgitg/gitg-repository.c
@@ -1140,8 +1140,7 @@ on_loader_update (GitgShell *object,
static void
free_refs (GSList *refs)
{
- g_slist_foreach (refs, (GFunc)gitg_ref_free, NULL);
- g_slist_free (refs);
+ g_slist_free_full (refs, gitg_ref_free);
}
static gboolean
diff --git a/libgitg/gitg-revision.c b/libgitg/gitg-revision.c
index 4083515..4220ec3 100644
--- a/libgitg/gitg-revision.c
+++ b/libgitg/gitg-revision.c
@@ -53,8 +53,7 @@ G_DEFINE_BOXED_TYPE (GitgRevision, gitg_revision, gitg_revision_ref, gitg_revisi
static void
free_lanes (GitgRevision *rv)
{
- g_slist_foreach (rv->lanes, (GFunc)gitg_lane_free, NULL);
- g_slist_free (rv->lanes);
+ g_slist_free_full (rv->lanes, gitg_lane_free);
rv->lanes = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]