Next: , Previous: uFree_in_order, Up: Private Routines


3.2.5 uFree_post_order

Free a tree, in post-order sequence.

Synopsis

     #include <rbtree/rbtree.h>
     
     
     
static void uFree_post_order( Tree *tree, void (*nfree)(void *,void *), void *udata, SiblingOrder sibling_order );

Parameters

Tree *tree
the tree to destroy
void (*nfree)(void *,void *)
a routine to free the node data, may be RBTREE_NULL_DELETE
void *udata
a pointer to data to be passed to the action routine
SiblingOrder sibling_order
the order in which to free the tree
          
          
Possible values for a SiblingOrder are as follows: LEFT_TO_RIGHT, RIGHT_TO_LEFT

Description

This routine traverses the given tree, freeing (post-order) as we go. It's the fastest deletion routine. Use it when it doesn't matter in what order the data are deleted. This routine differs from Free_post_order in that it can pass along a pointer provided by the calling routine to the action routine, allowing arbitrary data to be available to the action routine. The node data is passed to a user-supplied free routine, if available.