2 Copyright 2020 Google LLC
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file or at
6 https://developers.google.com/open-source/licenses/bsd
14 struct tree_node
*tree_search(void *key
, struct tree_node
**rootp
,
15 int (*compare
)(const void *, const void *),
24 REFTABLE_CALLOC_ARRAY(n
, 1);
31 res
= compare(key
, (*rootp
)->key
);
33 return tree_search(key
, &(*rootp
)->left
, compare
, insert
);
35 return tree_search(key
, &(*rootp
)->right
, compare
, insert
);
39 void infix_walk(struct tree_node
*t
, void (*action
)(void *arg
, void *key
),
43 infix_walk(t
->left
, action
, arg
);
46 infix_walk(t
->right
, action
, arg
);
49 void tree_free(struct tree_node
*t
)