summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@freedesktop.org>2012-08-31 14:22:38 +0200
committerDebarshi Ray <debarshir@freedesktop.org>2013-01-09 15:32:59 +0100
commit9912e20532dc785da69346ae70577b75d6ec337d (patch)
tree031cc67b5d1350459b2e0d03e9c9da4c0586f44d
parent7818d410e868a1bd8a42eb0de1a754387561cedc (diff)
downloadtelepathy-logger-9912e20532dc785da69346ae70577b75d6ec337d.tar.gz
log-walker: Streamline the history code
Purely cosmetic. No changes in functionality.
-rw-r--r--telepathy-logger/log-walker.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/telepathy-logger/log-walker.c b/telepathy-logger/log-walker.c
index 94cb6d7..496027b 100644
--- a/telepathy-logger/log-walker.c
+++ b/telepathy-logger/log-walker.c
@@ -434,7 +434,6 @@ tpl_log_walker_get_events (GObject *source_object,
if (async_data->latest_event != NULL)
{
- GList *h;
TplEvent *event;
TplLogWalkerHistoryData *data;
gboolean skip;
@@ -451,21 +450,20 @@ tpl_log_walker_get_events (GObject *source_object,
}
async_data->latest_cache->data = g_list_delete_link (
- async_data->latest_cache->data, async_data->latest_event);
+ async_data->latest_cache->data, async_data->latest_event);
- h = priv->history;
- if (h == NULL ||
- ((TplLogWalkerHistoryData *) h->data)->iter !=
- async_data->latest_iter->data ||
- ((TplLogWalkerHistoryData *) h->data)->skip != skip)
+ data = (priv->history != NULL) ?
+ (TplLogWalkerHistoryData *) priv->history->data : NULL;
+
+ if (data == NULL ||
+ data->iter != async_data->latest_iter->data ||
+ data->skip != skip)
{
data = tpl_log_walker_history_data_new ();
data->iter = g_object_ref (async_data->latest_iter->data);
data->skip = skip;
priv->history = g_list_prepend (priv->history, data);
}
- else
- data = (TplLogWalkerHistoryData *) h->data;
data->count++;
@@ -511,7 +509,6 @@ tpl_log_walker_rewind (TplLogWalker *walker,
GError **error)
{
TplLogWalkerPriv *priv;
- GList *h;
GList *k;
GList *l;
guint i;
@@ -546,12 +543,11 @@ tpl_log_walker_rewind (TplLogWalker *walker,
*cache = NULL;
}
- h = priv->history;
-
while (i < num_events && priv->is_start == FALSE)
{
- TplLogWalkerHistoryData *data = (TplLogWalkerHistoryData *) h->data;
+ TplLogWalkerHistoryData *data;
+ data = (TplLogWalkerHistoryData *) priv->history->data;
tpl_log_iter_rewind (data->iter, 1, error);
data->count--;
if (!data->skip)
@@ -560,9 +556,8 @@ tpl_log_walker_rewind (TplLogWalker *walker,
if (data->count == 0)
{
tpl_log_walker_history_data_free (data);
- priv->history = g_list_delete_link (priv->history, h);
- h = priv->history;
- if (h == NULL)
+ priv->history = g_list_delete_link (priv->history, priv->history);
+ if (priv->history == NULL)
priv->is_start = TRUE;
}
}