mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
gsequence: Improve is_end()
Instead of finding the GSequence, just walk up the tree and determine if the iter is the end node. https://bugzilla.gnome.org/show_bug.cgi?id=749583 Signed-off-by: Garrett Regier <garrettregier@gmail.com>
This commit is contained in:
parent
1249e10b8e
commit
c494ae06b7
@ -184,20 +184,24 @@ check_iter_access (GSequenceIter *iter)
|
||||
static gboolean
|
||||
is_end (GSequenceIter *iter)
|
||||
{
|
||||
GSequence *seq;
|
||||
GSequenceIter *parent = iter->parent;
|
||||
|
||||
if (iter->right)
|
||||
return FALSE;
|
||||
|
||||
if (!iter->parent)
|
||||
if (!parent)
|
||||
return TRUE;
|
||||
|
||||
if (iter->parent->right != iter)
|
||||
return FALSE;
|
||||
while (parent->right == iter)
|
||||
{
|
||||
iter = parent;
|
||||
parent = iter->parent;
|
||||
|
||||
seq = get_sequence (iter);
|
||||
if (!parent)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return seq->end_node == iter;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
Loading…
Reference in New Issue
Block a user