test.c (410B)
1#include "allocator.h" 2 3#include <err.h> 4#include <string.h> 5#include <stdlib.h> 6 7const struct allocator *ga = &stdlib_heap_allocator; 8 9int 10main(int argc, const char **argv) 11{ 12 struct test *test; 13 int rc; 14 15 if (argc <= 1) exit(1); 16 17 test = ga->alloc(ga, strtoull(argv[1], NULL, 10), &rc); 18 if (!test) errx(1, "alloc: %s", strerror(rc)); 19 20 rc = ga->free(ga, test); 21 if (rc) errx(1, "free: %s", strerror(rc)); 22}