aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--embed/downloader-view.c19
-rw-r--r--src/bookmarks/ephy-topic-action.c8
-rw-r--r--src/language-editor.c19
-rwxr-xr-xsrc/pdm-dialog.c20
5 files changed, 42 insertions, 35 deletions
diff --git a/ChangeLog b/ChangeLog
index cd2a85e62..adebdcb84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-06-14 Christian Persch <chpe@cvs.gnome.org>
+
+ * src/ephy-topic-action.c: (build_bookmarks_menu),
+ (build_topics_menu):
+ * src/language-dialog.c: (language_editor_remove_button_clicked_cb):
+ * src/pdm-dialog.c: (pdm_dialog_remove_button_clicked_cb):
+ * embed/downloader-view.c: (download_dialog_abort_cb):
+
+ Use g_list_prepend instead of g_list_append, and fix mem leaks
+ along the way.
+
2003-06-14 Marco Pesenti Gritti <marco@it.gnome.org>
* embed/ephy-embed-types.h:
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 390fd98d5..34e8275da 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -853,19 +853,19 @@ download_dialog_pause_cb (GtkButton *button, DownloaderView *dv)
void
download_dialog_abort_cb (GtkButton *button, DownloaderView *dv)
{
- GList *l, *r = NULL;
+ GList *llist, *rlist = NULL, *l, *r;
GtkTreeSelection *selection;
GtkTreeModel *model;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview));
- l = gtk_tree_selection_get_selected_rows (selection, &model);
- for (;l != NULL; l = l->next)
+ llist = gtk_tree_selection_get_selected_rows (selection, &model);
+ for (l = llist;l != NULL; l = l->next)
{
- r = g_list_append (r, gtk_tree_row_reference_new
- (model, (GtkTreePath *)l->data));
+ rlist = g_list_prepend (rlist, gtk_tree_row_reference_new
+ (model, (GtkTreePath *)l->data));
}
- for (; r != NULL; r = g_list_next (r))
+ for (r = rlist; r != NULL; r = r->next)
{
GtkTreeRowReference *node = r->data;
GValue val = {0, };
@@ -891,10 +891,9 @@ download_dialog_abort_cb (GtkButton *button, DownloaderView *dv)
gtk_tree_row_reference_free (node);
}
- l = g_list_first (l);
- g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (l);
- g_list_free (r);
+ g_list_foreach (llist, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (llist);
+ g_list_free (rlist);
}
static void
diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c
index f5afa6155..8a6abed4e 100644
--- a/src/bookmarks/ephy-topic-action.c
+++ b/src/bookmarks/ephy-topic-action.c
@@ -199,11 +199,11 @@ build_bookmarks_menu (EphyTopicAction *action, EphyNode *node)
for (i = 0; i < children->len; ++i)
{
- node_list = g_list_append (node_list,
+ node_list = g_list_prepend (node_list,
g_ptr_array_index (children, i));
}
- g_list_sort (node_list, (GCompareFunc)sort_bookmarks);
+ node_list = g_list_sort (node_list, (GCompareFunc)sort_bookmarks);
for (l = g_list_first (node_list); l != NULL; l = g_list_next (l))
{
@@ -308,11 +308,11 @@ build_topics_menu (EphyTopicAction *action, EphyNode *node)
for (i = 0; i < children->len; ++i)
{
- node_list = g_list_append (node_list,
+ node_list = g_list_prepend (node_list,
g_ptr_array_index (children, i));
}
- g_list_sort (node_list, (GCompareFunc)sort_topics);
+ node_list = g_list_sort (node_list, (GCompareFunc)sort_topics);
for (l = g_list_first (node_list); l != NULL; l = g_list_next (l))
{
diff --git a/src/language-editor.c b/src/language-editor.c
index 7c24f99fd..893693353 100644
--- a/src/language-editor.c
+++ b/src/language-editor.c
@@ -197,20 +197,20 @@ static void
language_editor_remove_button_clicked_cb (GtkButton *button,
LanguageEditor *editor)
{
- GList *l, *r = NULL;
+ GList *llist, *rlist = NULL, *l, *r;
GtkTreeIter iter;
GtkTreeSelection *selection;
GtkTreeModel *model;
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(editor->priv->treeview));
- l = gtk_tree_selection_get_selected_rows (selection, &model);
- for (;l != NULL; l = l->next)
+ llist = gtk_tree_selection_get_selected_rows (selection, &model);
+ for (l = llist;l != NULL; l = l->next)
{
- r = g_list_append (r, gtk_tree_row_reference_new
- (model, (GtkTreePath *)l->data));
+ rlist = g_list_prepend (rlist, gtk_tree_row_reference_new
+ (model, (GtkTreePath *)l->data));
}
- for (; r != NULL; r = r->next)
+ for (r = rlist; r != NULL; r = r->next)
{
GtkTreePath *node;
@@ -224,10 +224,9 @@ language_editor_remove_button_clicked_cb (GtkButton *button,
gtk_tree_row_reference_free ((GtkTreeRowReference *)r->data);
}
- l = g_list_first (l);
- g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (l);
- g_list_free (r);
+ g_list_foreach (llist, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (llist);
+ g_list_free (rlist);
language_editor_update_pref (editor);
}
diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 87e594812..c7119b065 100755
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -312,22 +312,21 @@ static void
pdm_dialog_remove_button_clicked_cb (GtkWidget *button,
PdmActionInfo *action)
{
- GList *l, *r = NULL;
+ GList *llist, *rlist = NULL, *l, *r;
GList *remove_list = NULL;
GtkTreeModel *model;
GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection
(GTK_TREE_VIEW(action->treeview));
- l = gtk_tree_selection_get_selected_rows
- (selection, &model);
- for (;l != NULL; l = l->next)
+ llist = gtk_tree_selection_get_selected_rows (selection, &model);
+ for (l = llist;l != NULL; l = l->next)
{
- r = g_list_append (r, gtk_tree_row_reference_new
- (model, (GtkTreePath *)l->data));
+ rlist = g_list_prepend (rlist, gtk_tree_row_reference_new
+ (model, (GtkTreePath *)l->data));
}
- for (; r != NULL; r = r->next)
+ for (r = rlist; r != NULL; r = r->next)
{
GtkTreeIter iter;
gpointer data;
@@ -358,10 +357,9 @@ pdm_dialog_remove_button_clicked_cb (GtkWidget *button,
action->free (action, remove_list);
}
- l = g_list_first (l);
- g_list_foreach (l, (GFunc)gtk_tree_path_free, NULL);
- g_list_free (l);
- g_list_free (r);
+ g_list_foreach (llist, (GFunc)gtk_tree_path_free, NULL);
+ g_list_free (llist);
+ g_list_free (rlist);
}
static void