From 729964bea692f9683860978b89848784a7fc2f46 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 30 Aug 2026 20:52:43 +0000 Subject: Still a lot to be done, but I'm going to bed. Two remaining big issues: * aplwc (the parameter passed "everywhere") - should it move or not? * values returned from the public API should not move. FossilOrigin-Name: 31ab3154b8f3d5ac167218496e9e204324bf0ac9d36b7bada8fe2a6c8f93d51c --- tests/aplwc_eval.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'tests/aplwc_eval.c') diff --git a/tests/aplwc_eval.c b/tests/aplwc_eval.c index c284189..68ea4a8 100644 --- a/tests/aplwc_eval.c +++ b/tests/aplwc_eval.c @@ -1,15 +1,31 @@ #include #include +#include #include +static void * +my_alloc(size_t min, size_t max, size_t *actual) +{ + (void)max; + + *actual = min; + return malloc(min); +} + +static void +my_dealloc(void *p) +{ + free(p); +} + int main(int argc, char *argv[]) { - uint8_t data[64000]; char *input; struct aplwc *aplwc; struct aplwc_line *line; struct aplwc_value *value; + struct aplwc_fns fns; enum aplwc_rc ret; FILE *f; long input_size; @@ -35,7 +51,12 @@ main(int argc, char *argv[]) return 1; input[input_size] = 0; - ret = aplwc_new(&aplwc, data, sizeof(data)); + + memset(&fns, 0, sizeof(fns)); + fns.alloc = my_alloc; + fns.dealloc = my_dealloc; + + ret = aplwc_new(&aplwc, fns); if(ret) return 1; -- cgit v1.2.3