From 2e3f21a2c6e4f34eeb8713b2438f5ec836bce0bb Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 10 Aug 2012 16:52:11 +0200 Subject: [PATCH] log-store-xml: Filter out duplicate dates in get_dates Fixes: https://bugs.freedesktop.org/53345 --- telepathy-logger/log-store-xml.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c index 2ec534f..83a39a3 100644 --- a/telepathy-logger/log-store-xml.c +++ b/telepathy-logger/log-store-xml.c @@ -921,6 +921,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; @@ -973,6 +974,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); -- 1.7.11.2