]>
Commit | Line | Data |
---|---|---|
be0959d2 DK |
1 | #include <stdio.h> |
2 | ||
3 | #ifndef GC_DEBUG | |
4 | # define GC_DEBUG | |
5 | #endif | |
6 | ||
7 | #include "gc.h" | |
8 | ||
9 | struct treenode { | |
10 | struct treenode *x; | |
11 | struct treenode *y; | |
12 | } * root[10]; | |
13 | ||
14 | struct treenode * libsrl_mktree(int i) | |
15 | { | |
16 | struct treenode * r = GC_MALLOC(sizeof(struct treenode)); | |
17 | if (0 == i) return 0; | |
18 | if (1 == i) r = GC_MALLOC_ATOMIC(sizeof(struct treenode)); | |
19 | r -> x = libsrl_mktree(i-1); | |
20 | r -> y = libsrl_mktree(i-1); | |
21 | return r; | |
22 | } | |
23 | ||
24 | void * libsrl_init(void) | |
25 | { | |
26 | GC_INIT(); | |
27 | return GC_MALLOC(sizeof(struct treenode)); | |
28 | } | |
29 | ||
30 | void * libsrl_collect (void) | |
31 | { | |
32 | GC_gcollect(); | |
33 | } |