Next: , Previous: rbtree_delete, Up: Public Routines


3.1.5 rbtree_udelete

Delete a red-black binary tree.

Synopsis

     #include <rbtree/rbtree.h>
     
     
     
void rbtree_udelete( RBTree rbtree, void (*nfree)(void *,void *), void *udata, Visit visit, SiblingOrder sibling_order );

Parameters

RBTree rbtree
the handle of the rbtree to delete
void (*nfree)(void *,void *)
a routine which deallocates node user memory, may be RBTREE_NULL_DELETE
void *udata
a pointer to data to be passed to the action routine
Visit visit
the order of deletion. (PRE_ORDER is treated as POST_ORDER)
          
          
Possible values for a Visit are as follows: PRE_ORDER, IN_ORDER, POST_ORDER
SiblingOrder sibling_order
the direction that the tree is parsed
          
          
Possible values for a SiblingOrder are as follows: LEFT_TO_RIGHT, RIGHT_TO_LEFT

Description

This routine deletes a red-black binary tree, destroying all nodes in the specified order and direction. It optionally takes a user supplied function which, when passed a node's data pointer, deallocates possible user node data. It is strongly suggested that the deallocation function be specified. This routine differs from rbtree_delete in that it can pass along a pointer provided by the calling routine to the deallocation function routine, allowing arbitrary data to be available to it.