/* Walk the nodes of a tree */ static void trecurse(node *root, void (*action)(const void *, VISIT, int), int level) { if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0) (*action)(root, leaf, level); else { (*action)(root, preorder, level); if (root->left != (struct node_t *)0) trecurse(root->left, action, level + 1); (*action)(root, postorder, level); if (root->right != (struct node_t *)0) trecurse(root->right, action, level + 1); (*action)(root, endorder, level); } }
static void trecurse(node *root, __action_fn_t action, int level) /* Walk the nodes of a tree */ { if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0) (*action)(root, leaf, level); else { (*action)(root, preorder, level); if (root->left != NULL) trecurse(root->left, action, level + 1); (*action)(root, postorder, level); if (root->right != NULL) trecurse(root->right, action, level + 1); (*action)(root, endorder, level); } }
/* Walk the nodes of a tree */ static void trecurse(const posix_tnode *root, cmp_fn_t action, 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 */ void twalk (const void *vroot, /* Root of the tree to be walked */ void (*action) (const void *, VISIT, int)) { if (vroot != NULL && action != NULL) trecurse(vroot, action, 0); }
/* Walk the nodes of a tree. ROOT is the root of the tree to be walked, ACTION the function to be called at each node. LEVEL is the level of ROOT in the whole tree. */ static void trecurse (const void *vroot, __action_fn_t action, int level) { const_node root = (const_node) vroot; if (root->left == NULL && root->right == NULL) (*action) (root, leaf, level); else { (*action) (root, preorder, level); if (root->left != NULL) trecurse (root->left, action, level + 1); (*action) (root, postorder, level); if (root->right != NULL) trecurse (root->right, action, level + 1); (*action) (root, endorder, level); } }
/* Walk the nodes of a tree */ void twalk(const void *vroot, void (*action)(const void *, VISIT, int)) { node *root = (node *)vroot; if (root != (node *)0 && action != (void (*)(const void *, VISIT, int))0) trecurse(root, action, 0); }
/* Walk the nodes of a tree */ static void trecurse(const node_t *root, /* Root of the tree to be walked */ cmp_fn_t action, 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. ROOT is the root of the tree to be walked, ACTION the function to be called at each node. */ void __twalk (const void *vroot, __action_fn_t action) { const_node root = (const_node) vroot; CHECK_TREE (root); if (root != NULL && action != NULL) trecurse (root, action, 0); }
/* Walk the nodes of a tree. ROOT is the root of the tree to be walked, ACTION the function to be called at each node. LEVEL is the level of ROOT in the whole tree. */ static void internal_function trecurse (const void *vroot, __action_fn_t action, int level) { const_node root = (const_node) vroot; if (LEFT(root) == NULL && RIGHT(root) == NULL) (*action) (root, leaf, level); else { (*action) (root, preorder, level); if (LEFT(root) != NULL) trecurse (LEFT(root), action, level + 1); (*action) (root, postorder, level); if (RIGHT(root) != NULL) trecurse (RIGHT(root), action, level + 1); (*action) (root, endorder, level); } }
void twalk(void *root, __action_fn_t action) /* Walk the nodes of a tree */ { if (root != NULL && action != NULL) trecurse(root, action, 0); }
/* Walk the nodes of a tree */ void twalk(const posix_tnode *vroot, cmp_fn_t action) { if (vroot != NULL && action != NULL) trecurse(vroot, action, 0); }
/* Walk the nodes of a tree */ void twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */ { if (vroot != NULL && action != NULL) trecurse(vroot, action, 0); }