Next: , Previous: rbtree_destroy_node, Up: Public Routines


3.1.9 rbtree_detach_node

Remove a node from an red-black tree without destroying it.

Synopsis

     #include <rbtree/rbtree.h>
     
     
     
RBNode rbtree_detach_node( RBTree rbtree, RBNode rbnode );

Parameters

RBTree rbtree
the tree from which to remove the node
RBNode rbnode
the node to detach

Description

rbtree_detach_node detaches the specified node from the specified tree, but doesn't delete it. This is useful for inserting the node into another tree. Because of the way nodes are deleted from trees, the node actually removed may not be the node passed to the routine. The user supplied data is correctly tracked.

Returns

Returns the node that was actually detached, or NULL if the node is NULL or NIL(tree).