summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-23 16:11:52 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-23 16:11:52 (EDT)
commit8b377cf9ce039dbfdfdd128abaa0c3ed93dff941 (patch)
treed50fa9a13acb0f321a33d375ab27eda17aa49478
parent971b7357fd741fac5f501982cd73925de76e9cc4 (diff)
downloadmarquee-8b377cf9ce039dbfdfdd128abaa0c3ed93dff941.zip
marquee-8b377cf9ce039dbfdfdd128abaa0c3ed93dff941.tar.gz
marquee-8b377cf9ce039dbfdfdd128abaa0c3ed93dff941.tar.bz2
mq_tree_seek(): Fix assertion failures in recursive calls
-rw-r--r--src/tree.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/tree.c b/src/tree.c
index fc82cf6..7479e80 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -122,13 +122,8 @@ mq_tree_remove(MqTree *node)
}
MqTree *
-mq_tree_seek(MqTree *node, gint offset)
+seek(MqTree *node, gint offset)
{
- /* XXX: Only forward seeking from a tree's root is supported. */
- g_assert(node);
- g_assert(node->position == 0);
- g_assert(offset > 0);
-
/* Skip forward to the containing subtree. */
while (node && node->position + node->size <= offset) {
node = node->next;
@@ -145,7 +140,18 @@ mq_tree_seek(MqTree *node, gint offset)
}
/* Recurse down the subtree. */
- return mq_tree_seek(node->first_child, offset);
+ return seek(node->first_child, offset);
+}
+
+MqTree *
+mq_tree_seek(MqTree *node, gint offset)
+{
+ /* XXX: Only forward seeking from a tree's root is supported. */
+ g_assert(node);
+ g_assert(node->position == 0);
+ g_assert(offset > 0);
+
+ return seek(node, offset);
}
static gboolean