[gnome-logs/wip/gl-journal] Add method to free result lists



commit 6e097629e8294b374beaa93e43019ec39788a31b
Author: David King <davidk gnome org>
Date:   Wed Oct 2 17:54:44 2013 +0100

    Add method to free result lists

 src/gl-journal.c |   16 ++++++++++++++++
 src/gl-journal.h |    1 +
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/gl-journal.c b/src/gl-journal.c
index 0923da7..78188e5 100644
--- a/src/gl-journal.c
+++ b/src/gl-journal.c
@@ -289,6 +289,22 @@ out:
     return g_list_reverse (results);
 }
 
+static void
+gl_journal_result_free (GlJournalResult *result,
+                        G_GNUC_UNUSED gpointer user_data)
+{
+    g_slice_free (GlJournalResult, result);
+}
+
+void
+gl_journal_results_free (G_GNUC_UNUSED GlJournal *self,
+                         GList *results)
+{
+    /* As self is unused, ignore it. */
+    g_list_foreach (results, (GFunc)gl_journal_result_free, NULL);
+    g_list_free (results);
+}
+
 sd_journal *
 gl_journal_get_journal (GlJournal *self)
 {
diff --git a/src/gl-journal.h b/src/gl-journal.h
index 13cc0e4..2370015 100644
--- a/src/gl-journal.h
+++ b/src/gl-journal.h
@@ -57,6 +57,7 @@ typedef struct
 
 GType gl_journal_get_type (void);
 GList * gl_journal_query (GlJournal *self, GlJournalQuery *query);
+void gl_journal_results_free (G_GNUC_UNUSED GlJournal *self, GList *results);
 sd_journal * gl_journal_get_journal (GlJournal *self);
 GlJournal * gl_journal_new (void);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]