Next: , Previous: rbtree_detach_node, Up: Public Routines


3.1.10 rbtree_insert

Create and insert a node into a red-black tree.

Synopsis

     #include <rbtree/rbtree.h>
     
     
     
int rbtree_insert( RBTree rbtree, void *data );

Parameters

RBTree rbtree
a handle to the tree into which to insert the node
void *data
a pointer to the data

Description

rbtree_insert creates a node, sets its data pointer to the specified pointer, and inserts it into the specified tree.

Returns

It returns `0' if the insert was successful, `1' if it was unable to create the new node.