dns response handling: ignore presence of wrong-type RRs
[musl] / src / search / twalk.c
1 #include <search.h>
2 #include "tsearch.h"
3
4 static void walk(const struct node *r, void (*action)(const void *, VISIT, int), int d)
5 {
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);
16         }
17 }
18
19 void twalk(const void *root, void (*action)(const void *, VISIT, int))
20 {
21         walk(root, action, 0);
22 }