Import boehm-gc snapshot, taken from
[official-gcc.git] / boehm-gc / tests / staticrootslib.c
blob2a8fcd49cd5f8ccd170fe789ed8074a8996defcd
2 /* This test file is intended to be compiled into a DLL. */
4 #include <stdio.h>
6 #ifndef GC_DEBUG
7 # define GC_DEBUG
8 #endif
10 #include "gc.h"
12 struct treenode {
13 struct treenode *x;
14 struct treenode *y;
15 } * root[10];
17 struct treenode * libsrl_mktree(int i)
19 struct treenode * r = GC_MALLOC(sizeof(struct treenode));
20 if (0 == i) return 0;
21 if (1 == i) r = GC_MALLOC_ATOMIC(sizeof(struct treenode));
22 if (r) {
23 r -> x = libsrl_mktree(i-1);
24 r -> y = libsrl_mktree(i-1);
26 return r;
29 void * libsrl_init(void)
31 GC_INIT();
32 return GC_MALLOC(sizeof(struct treenode));