]> git.ozlabs.org Git - ccan/blob - ccan/talloc/test/run-test_autofree.c
tdb2: try to fit transactions in existing space before we expand.
[ccan] / ccan / talloc / test / run-test_autofree.c
1 #include <ccan/talloc/talloc.c>
2 #include <stdbool.h>
3 #include <ccan/tap/tap.h>
4
5 static int destroy_int(int *p)
6 {
7         ok1(*p == 7);
8         _exit(0);
9 }
10
11 int main(int argc, char *argv[])
12 {
13         int *p;
14
15         /* If autofree context doesn't work, we won't run all tests! */
16         plan_tests(1);
17
18         p = talloc(talloc_autofree_context(), int);
19         *p = 7;
20         talloc_set_destructor(p, destroy_int);
21
22         /* Note!  We fail here, unless destructor called! */
23         exit(1);
24 }
25