]> git.ozlabs.org Git - ccan/blob - ccan/alloc/test/run-corrupt.c
alloc: fix examples so they compile.
[ccan] / ccan / alloc / test / run-corrupt.c
1 /* Example allocation which caused corruption. */
2 #include <ccan/alloc/alloc.c>
3 #include <ccan/alloc/bitops.c>
4 #include <ccan/alloc/tiny.c>
5 #include <ccan/tap/tap.h>
6 #include <stdlib.h>
7
8 int main(int argc, char *argv[])
9 {
10         void *mem;
11
12         plan_tests(7);
13
14         mem = malloc(1179648);
15         alloc_init(mem, 1179648);
16         ok1(alloc_check(mem, 1179648));
17         ok1(alloc_get(mem, 1179648, 48, 16));
18         ok1(alloc_check(mem, 1179648));
19         ok1(alloc_get(mem, 1179648, 53, 16));
20         ok1(alloc_check(mem, 1179648));
21         ok1(alloc_get(mem, 1179648, 53, 16));
22         ok1(alloc_check(mem, 1179648));
23         free(mem);
24
25         return exit_status();
26 }