AVL_DESTROY_NODES(3AVL) AVL Tree Library Functions AVL_DESTROY_NODES(3AVL)

NAME


avl_destroy_nodes - efficiently remove nodes from an AVL tree

SYNOPSIS


AVL Tree Library (libavl, -lavl)
#include <sys/avl.h>

void *
avl_destroy_nodes(avl_tree_t *tree, void **cookie);

DESCRIPTION


The avl_destroy_nodes() function is used to efficiently remove nodes
from the AVL tree rooted at tree.

After the avl_destroy_nodes() function is called on an AVL tree, the
only valid functions that may be called on it are additional calls to
avl_destroy_nodes() and finally avl_destroy().

Before calling avl_destroy_nodes(), callers must first initialize a
value of type void * to NULL and pass a pointer to it as the argument
cookie. This is an opaque value that will be used to maintain where to
next delete items from the tree. Callers should never modify it after
initializing it. After each call to avl_destroy_nodes(), cookie will
be updated and must be passed to subsequent calls to
avl_destroy_nodes().

Each time avl_destroy_nodes() is called, it will return a pointer to an
object that had previously been inserted into the tree, allowing a
caller the opportunity to delete or clean it up. Once
avl_destroy_nodes() returns a NULL pointer, then the tree is empty and
the caller should proceed to call avl_destroy(3AVL).

The examples in libavl(3LIB) demonstrate the correct usage of this
interface.

RETURN VALUES


The avl_destroy_nodes() function will return a pointer to the object
just removed from the tree rooted at tree and if tree is empty, it will
return NULL.

EXAMPLES


See the EXAMPLES section in libavl(3LIB).

INTERFACE STABILITY


Committed

MT-Level
See Locking in libavl(3LIB).

SEE ALSO


avl_destroy(3AVL), libavl(3LIB)

illumos December 3, 2015 illumos

tribblix@gmail.com :: GitHub :: Privacy