diff options
| author | peter <peter@pmikkelsen.com> | 2026-08-31 20:22:47 +0000 |
|---|---|---|
| committer | peter <peter@pmikkelsen.com> | 2026-08-31 20:22:47 +0000 |
| commit | 8b0beb9e6a57c1d4f1e7b0b06523dd0fc538771a (patch) | |
| tree | 9bb8b689020d5098ea3c31251ddcd2fbb9524a7c /src/lib/module.c | |
| parent | d361abaeb8dcf19446a9322737ea600b22568a5b (diff) | |
| parent | f9f9b10c1d17077632d7a09e447e629b8d33b23d (diff) | |
Merge memory manager changes into trunk
FossilOrigin-Name: af583e3ba70b2d10efdead8e03a42fe5c1b94d6b387522833606c138b527a653
Diffstat (limited to 'src/lib/module.c')
| -rw-r--r-- | src/lib/module.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/lib/module.c b/src/lib/module.c index 9a202f9..2524eca 100644 --- a/src/lib/module.c +++ b/src/lib/module.c @@ -58,12 +58,17 @@ load_module(struct aplwc *aplwc, struct string *name, struct token_list *tokens) enum aplwc_rc rc; struct aplwc_module *module; - module = memory_alloc_aplwc_module(&aplwc->memory); + MEMPTRS(aplwc, 2); + + MEMPTR(0, name); + MEMPTR(1, tokens); + + module = memory_alloc_aplwc_module(aplwc); if(module == NULL){ - aplwc->last_error = APLWC_OUT_OF_MEMORY; - return aplwc->last_error; + rc = aplwc_last_error(aplwc); + goto end; } - module->aplwc = aplwc; + module->name = name; module->tokens = tokens; module->link = NULL; @@ -72,10 +77,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{ - memory_free_aplwc_module(&aplwc->memory, module); - } + }else + aplwc->last_error = rc; +end: + MEMPTRS_EXIT(aplwc); return rc; } |