telepathy-logger: log-store-xml: Filter out duplicate dates in get_dates

Xavier Claessens xclaesse at kemper.freedesktop.org
Sat Dec 29 07:45:49 PST 2012


Module: telepathy-logger
Branch: master
Commit: 6b9494268d300f98a8bf9e72280608431aeb7f49
URL:    http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=6b9494268d300f98a8bf9e72280608431aeb7f49

Author: Nicolas Dufresne <nicolas.dufresne at collabora.com>
Date:   Fri Aug 10 16:52:11 2012 +0200

log-store-xml: Filter out duplicate dates in get_dates

Fixes: https://bugs.freedesktop.org/53345

---

 telepathy-logger/log-store-xml.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c
index bde4ca5..cf6a2f9 100644
--- a/telepathy-logger/log-store-xml.c
+++ b/telepathy-logger/log-store-xml.c
@@ -920,6 +920,7 @@ log_store_xml_get_dates (TplLogStore *store,
 {
   TplLogStoreXml *self = (TplLogStoreXml *) store;
   GList *dates = NULL;
+  GList *l;
   gchar *directory = NULL;
   GDir *dir = NULL;
   GString *pattern = NULL;
@@ -972,6 +973,18 @@ log_store_xml_get_dates (TplLogStore *store,
       g_free (str);
     }
 
+  /* Filter out duplicate dates in-place */
+  for (l = dates; g_list_next (l) != NULL; l = g_list_next (l))
+    {
+      GList *next = g_list_next (l);
+
+      if (g_date_compare ((GDate *) next->data, (GDate *) l->data) == 0)
+        {
+          g_date_free ((GDate *) next->data);
+          l = g_list_delete_link (l, next);
+        }
+    }
+
 out:
   g_free (directory);
 



More information about the telepathy-commits mailing list