mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-24 01:48:53 +02:00
Added function to keep symetry with g_node_insert_before. 2000-09-29
2000-09-29 Jonathan Blandford <jrb@redhat.com> * gnode.c (g_node_insert_after): Added function to keep symetry with g_node_insert_before. 2000-09-29 Jonathan Blandford <jrb@redhat.com> * glib/tmpl/trees-nary.sgml: Add g_node_insert_after().
This commit is contained in:
committed by
Jonathan Blandford
parent
79b416d023
commit
b3ee868f94
36
gnode.c
36
gnode.c
@@ -280,6 +280,42 @@ g_node_insert_before (GNode *parent,
|
||||
return node;
|
||||
}
|
||||
|
||||
GNode*
|
||||
g_node_insert_after (GNode *parent,
|
||||
GNode *sibling,
|
||||
GNode *node)
|
||||
{
|
||||
g_return_val_if_fail (parent != NULL, node);
|
||||
g_return_val_if_fail (node != NULL, node);
|
||||
g_return_val_if_fail (G_NODE_IS_ROOT (node), node);
|
||||
if (sibling)
|
||||
g_return_val_if_fail (sibling->parent == parent, node);
|
||||
|
||||
node->parent = parent;
|
||||
|
||||
if (sibling)
|
||||
{
|
||||
if (sibling->next)
|
||||
{
|
||||
sibling->next->prev = node;
|
||||
}
|
||||
node->next = sibling->next;
|
||||
node->prev = sibling;
|
||||
sibling->next = node;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parent->children)
|
||||
{
|
||||
node->next = parent->children;
|
||||
parent->children->prev = node;
|
||||
}
|
||||
parent->children = node;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
GNode*
|
||||
g_node_prepend (GNode *parent,
|
||||
GNode *node)
|
||||
|
Reference in New Issue
Block a user