summaryrefslogtreecommitdiff
path: root/glib/gnode.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2000-09-29 23:13:02 +0000
committerJonathan Blandford <jrb@src.gnome.org>2000-09-29 23:13:02 +0000
commitb3ee868f9443d4de4b26d159e49fbd2c512ee1e8 (patch)
tree56c5fea5a86f03d50f5ff8b14410cf32d80267e0 /glib/gnode.c
parent79b416d0233f0f293274aa688d464fc27eaaa412 (diff)
downloadglib-b3ee868f9443d4de4b26d159e49fbd2c512ee1e8.tar.gz
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().
Diffstat (limited to 'glib/gnode.c')
-rw-r--r--glib/gnode.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/glib/gnode.c b/glib/gnode.c
index d09c8ef79..5b72300c5 100644
--- a/glib/gnode.c
+++ b/glib/gnode.c
@@ -281,6 +281,42 @@ g_node_insert_before (GNode *parent,
}
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)
{