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



commit 90db567893dab1a9d6cdf86f83299ecdf9821eb6
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 5ea29be..98b43e6 100644
--- a/src/gl-journal.c
+++ b/src/gl-journal.c
@@ -316,6 +316,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 3728a87..9ecdd89 100644
--- a/src/gl-journal.h
+++ b/src/gl-journal.h
@@ -59,6 +59,7 @@ typedef struct
 
 GType gl_journal_get_type (void);
 GList * gl_journal_query (GlJournal *self, const 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]