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 --- src/lib/module.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/lib/module.c') diff --git a/src/lib/module.c b/src/lib/module.c index f559f00..3bca396 100644 --- a/src/lib/module.c +++ b/src/lib/module.c @@ -58,9 +58,17 @@ load_module(struct aplwc *aplwc, struct string *name, struct token_list *tokens) enum aplwc_rc rc; struct aplwc_module *module; + MEMPTRS(aplwc, 2); + + MEMPTR(0, name); + MEMPTR(1, tokens); + module = memory_alloc_aplwc_module(aplwc); - if(module == NULL) - return aplwc->last_error; + if(module == NULL){ + rc = aplwc_last_error(aplwc); + goto end; + } + module->aplwc = aplwc; module->name = name; module->tokens = tokens; @@ -70,8 +78,11 @@ load_module(struct aplwc *aplwc, struct string *name, struct token_list *tokens) if(rc == APLWC_OK){ module->link = aplwc->modules; aplwc->modules = module; - } + }else + aplwc->last_error = rc; +end: + MEMPTRS_EXIT(aplwc); return rc; } -- cgit v1.2.3