[gnome-latex: 77/205] Optimisation + avoid memory leaks
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex: 77/205] Optimisation + avoid memory leaks
- Date: Fri, 14 Dec 2018 10:53:21 +0000 (UTC)
commit 0ab07dbf48914b8e0f2ae2b4db2b8846649c3313
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date: Sun Sep 20 18:35:50 2009 +0200
Optimisation + avoid memory leaks
src/actions.c | 8 ++++----
src/callbacks.c | 6 ++++--
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/actions.c b/src/actions.c
index 4ff2cc7..0b1ba7e 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -70,15 +70,15 @@ command_running_finished (void)
gchar *tmp;
command_output_list = g_slist_reverse (command_output_list);
- // TODO optimisation
- guint nb_lines = g_slist_length (command_output_list);
- for (gint i = 0 ; i < nb_lines ; i++)
+ GSList *current = command_output_list;
+ do
{
- gchar *line = g_slist_nth_data (command_output_list, i);
+ gchar *line = g_slist_nth_data (current, 0);
tmp = g_strdup_printf ("%s%s", command_output_string, line);
g_free (command_output_string);
command_output_string = tmp;
}
+ while ((current = g_slist_next (current)) != NULL);
// store the string to the action list store
GtkTreeIter iter;
diff --git a/src/callbacks.c b/src/callbacks.c
index 872b196..c650ec7 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -553,7 +553,8 @@ cb_latex (void)
compile_document (title, command);
- // TODO free command
+ g_free (command[0]);
+ g_free (command[2]);
}
void
@@ -572,7 +573,8 @@ cb_pdflatex (void)
compile_document (title, command);
- // TODO free command
+ g_free (command[0]);
+ g_free (command[2]);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]