set AD bit in dns queries, suppress for internal use
[musl.git] / src / search / twalk.c
blob53821cdaf34e7baa31c9fe164d20ca21515f462e
1 #include <search.h>
2 #include "tsearch.h"
4 static void walk(const struct node *r, void (*action)(const void *, VISIT, int), int d)
6 if (!r)
7 return;
8 if (r->h == 1)
9 action(r, leaf, d);
10 else {
11 action(r, preorder, d);
12 walk(r->a[0], action, d+1);
13 action(r, postorder, d);
14 walk(r->a[1], action, d+1);
15 action(r, endorder, d);
19 void twalk(const void *root, void (*action)(const void *, VISIT, int))
21 walk(root, action, 0);