From 04827577ea502a9f0edc69e00e008751c8119cbc Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 30 Aug 2026 14:46:38 +0000 Subject: Remove a lot of functions for manually freeing memory (they were not implemented) FossilOrigin-Name: 693765728e62a74a0ab15d657f7d1dd83702a9371fb042dafe6250f84a252959 --- src/lib/main.c | 41 +++++++++++------------------------------ 1 file changed, 11 insertions(+), 30 deletions(-) (limited to 'src/lib/main.c') diff --git a/src/lib/main.c b/src/lib/main.c index 2bd374b..81cd6bb 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -19,8 +19,7 @@ aplwc_new(struct aplwc **p, uint8_t *data, size_t size) void aplwc_destroy(struct aplwc *p) { - if(p) - memory_free_aplwc(p, p); + UNUSED_PARAMETER(p); } const char * @@ -97,9 +96,8 @@ aplwc_read(struct aplwc *aplwc, const char *line) void aplwc_free_line(struct aplwc_line *line) { - if(line == NULL) - return; - memory_free_aplwc_line(line->aplwc, line); + if(line) + memory_free_root(line->aplwc, line); } struct aplwc_value * @@ -112,9 +110,8 @@ aplwc_eval(struct aplwc_line *line) void aplwc_free_value(struct aplwc_value *value) { - if(value == NULL) - return; - memory_free_aplwc_value(value->aplwc, value); + if(value) + memory_free_root(value->aplwc, value); } const char * @@ -134,32 +131,16 @@ aplwc_load_module(struct aplwc *aplwc, const char *name, const char *src, int sr struct string *text, *namestr; struct token_list *tokens; - namestr = NULL; - text = NULL; - tokens = NULL; - - namestr = chars_to_string(aplwc, name, -1); - if(namestr == NULL) + if((namestr = chars_to_string(aplwc, name, -1)) == NULL) goto error; - - text = chars_to_string(aplwc, src, srclen); - if(text == NULL) + if((text = chars_to_string(aplwc, src, srclen)) == NULL) goto error; - - tokens = scan_string(aplwc, text, 0); - if(tokens == NULL) + if((tokens = scan_string(aplwc, text, 0)) == NULL) goto error; - - if(load_module(aplwc, namestr, tokens) == APLWC_OK) - return APLWC_OK; - else{ + if(load_module(aplwc, namestr, tokens) != APLWC_OK){ error: - if(tokens != NULL) - memory_free_token_list(aplwc, tokens); - if(text != NULL) - memory_free_string(aplwc, text); - if(namestr != NULL) - memory_free_string(aplwc, namestr); return aplwc_last_error(aplwc); } + + return APLWC_OK; } -- cgit v1.2.3