diff options
| author | Louis Burda <quent.burda@gmail.com> | 2024-05-10 02:06:31 +0200 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2024-05-10 02:06:31 +0200 |
| commit | dc35e35d0ba1bce4cd1ee5f4b1b94c8263b15b43 (patch) | |
| tree | 0cb58c0a87a7f744a61fd1f648bb9761205bbc1b /lib/liballoc/src/test.c | |
| parent | c3c03a382eb7dc9a32850da6615316faf4677a23 (diff) | |
| download | libidx-c-master.tar.gz libidx-c-master.zip | |
Diffstat (limited to 'lib/liballoc/src/test.c')
| -rw-r--r-- | lib/liballoc/src/test.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/liballoc/src/test.c b/lib/liballoc/src/test.c new file mode 100644 index 0000000..7b3ee44 --- /dev/null +++ b/lib/liballoc/src/test.c @@ -0,0 +1,22 @@ +#include "allocator.h" + +#include <err.h> +#include <string.h> +#include <stdlib.h> + +const struct allocator *ga = &stdlib_heap_allocator; + +int +main(int argc, const char **argv) +{ + struct test *test; + int rc; + + if (argc <= 1) exit(1); + + test = ga->alloc(ga, strtoull(argv[1], NULL, 10), &rc); + if (!test) errx(1, "alloc: %s", strerror(rc)); + + rc = ga->free(ga, test); + if (rc) errx(1, "free: %s", strerror(rc)); +} |
