Blame


1 492a274f 2021-10-07 op /*
2 492a274f 2021-10-07 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 492a274f 2021-10-07 op *
4 492a274f 2021-10-07 op * Permission to use, copy, modify, and distribute this software for any
5 492a274f 2021-10-07 op * purpose with or without fee is hereby granted, provided that the above
6 492a274f 2021-10-07 op * copyright notice and this permission notice appear in all copies.
7 492a274f 2021-10-07 op *
8 492a274f 2021-10-07 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 492a274f 2021-10-07 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 492a274f 2021-10-07 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 492a274f 2021-10-07 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 492a274f 2021-10-07 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 492a274f 2021-10-07 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 492a274f 2021-10-07 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 492a274f 2021-10-07 op */
16 492a274f 2021-10-07 op
17 492a274f 2021-10-07 op #include <sys/tree.h>
18 492a274f 2021-10-07 op
19 492a274f 2021-10-07 op #include <stdio.h>
20 492a274f 2021-10-07 op
21 492a274f 2021-10-07 op struct tree {
22 492a274f 2021-10-07 op int i;
23 492a274f 2021-10-07 op SPLAY_ENTRY(tree) entry;
24 492a274f 2021-10-07 op };
25 492a274f 2021-10-07 op SPLAY_HEAD(tree_id, tree);
26 492a274f 2021-10-07 op
27 492a274f 2021-10-07 op static int
28 492a274f 2021-10-07 op tree_cmp(struct tree *a, struct tree *b)
29 492a274f 2021-10-07 op {
30 492a274f 2021-10-07 op if (a->i == b->i)
31 492a274f 2021-10-07 op return 0;
32 492a274f 2021-10-07 op else if (a->i < b->i)
33 492a274f 2021-10-07 op return -1;
34 492a274f 2021-10-07 op else
35 492a274f 2021-10-07 op return +1;
36 492a274f 2021-10-07 op }
37 492a274f 2021-10-07 op
38 492a274f 2021-10-07 op SPLAY_PROTOTYPE(tree_id, tree, entry, tree_cmp);
39 492a274f 2021-10-07 op SPLAY_GENERATE(tree_id, tree, entry, tree_cmp);
40 492a274f 2021-10-07 op
41 492a274f 2021-10-07 op int
42 492a274f 2021-10-07 op main(void)
43 492a274f 2021-10-07 op {
44 492a274f 2021-10-07 op return 0;
45 492a274f 2021-10-07 op }