MCPcopy Create free account
hub / github.com/GJDuck/e9patch / tree_walk

Function tree_walk

examples/stdlib.c:5509–5524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5507}
5508
5509static void tree_walk(const struct node_s *n, int depth,
5510 void (*action)(const void *, const VISIT, const int))
5511{
5512 if (TREE_LEFT(n) == NULL && TREE_RIGHT(n) == NULL)
5513 action(n, leaf, depth);
5514 else
5515 {
5516 action(n, preorder, depth);
5517 if (TREE_LEFT(n) != NULL)
5518 tree_walk(TREE_LEFT(n), depth+1, action);
5519 action(n, postorder, depth);
5520 if (TREE_RIGHT(n) != NULL)
5521 tree_walk(TREE_RIGHT(n), depth+1, action);
5522 action(n, endorder, depth);
5523 }
5524}
5525static void twalk(const void *root,
5526 void (*action)(const void *, const VISIT, const int))
5527{

Callers 1

twalkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected