mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-18 19:51:57 +02: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
|
static gboolean
|
||||||
is_end (GSequenceIter *iter)
|
is_end (GSequenceIter *iter)
|
||||||
{
|
{
|
||||||
GSequence *seq;
|
GSequenceIter *parent = iter->parent;
|
||||||
|
|
||||||
if (iter->right)
|
if (iter->right)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!iter->parent)
|
if (!parent)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (iter->parent->right != iter)
|
while (parent->right == iter)
|
||||||
return FALSE;
|
{
|
||||||
|
iter = parent;
|
||||||
|
parent = iter->parent;
|
||||||
|
|
||||||
seq = get_sequence (iter);
|
if (!parent)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return seq->end_node == iter;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
Loading…
x
Reference in New Issue
Block a user