src/libcrt/search/twalk.c
static void
trecurse( const node_t *root,	/* Root of the tree to be walked */
	void (*action)(const void *, VISIT, int),
	int level)
{
	if (root->llink == NULL && root->rlink == NULL)
		(*action)(root, leaf, level);
	else {
		(*action)(root, preorder, level);
		if (root->llink != NULL)
			trecurse(root->llink, action, level + 1);
		(*action)(root, postorder, level);
		if (root->rlink != NULL)
			trecurse(root->rlink, action, level + 1);
		(*action)(root, endorder, level);
	}
}
/* Walk the nodes of a tree */
Walk the nodes of a tree
Walk the nodes of a tree
static void
trecurse( const node_t *root,	
	void (*action)(const void *, VISIT, int),
	int level)
{
	if (root->llink == NULL && root->rlink == NULL)
		(*action)(root, leaf, level);
	else {
		(*action)(root, preorder, level);
		if (root->llink != NULL)
			trecurse(root->llink, action, level + 1);
		(*action)(root, postorder, level);
		if (root->rlink != NULL)
			trecurse(root->rlink, action, level + 1);
		(*action)(root, endorder, level);
	}
}
static void trecurse ( const node_t * root , void ( * action ) ( const void * , VISIT , int ) , int level ) { if ( root -> llink == NULL && root -> rlink == NULL ) ( * action ) ( root , leaf , level ) ; else { ( * action ) ( root , preorder , level ) ; if ( root -> llink != NULL ) trecurse ( root -> llink , action , level + 1 ) ; ( * action ) ( root , postorder , level ) ; if ( root -> rlink != NULL ) trecurse ( root -> rlink , action , level + 1 ) ; ( * action ) ( root , endorder , level ) ; } }
Walk the nodes of a tree
Walk the nodes of a tree
/* Root of the tree to be walked */