From 8521b6a69deab8cdabe1c87b09ecdc93d75af98e Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 30 Aug 2026 14:20:55 +0000 Subject: Remove the struct memory struct FossilOrigin-Name: 38568a34f631b2a4eef72542e2988a9fe081f85d3248194c2ff995a9eed6bd5d --- src/lib/main.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/lib/main.c') diff --git a/src/lib/main.c b/src/lib/main.c index d6de538..fa7e547 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -4,14 +4,14 @@ enum aplwc_rc aplwc_new(struct aplwc **p, uint8_t *data, size_t size) { - struct memory m; + struct aplwc tmp_aplwc; - m = memory_init(data, size); + memory_init(&tmp_aplwc, data, size); - *p = memory_alloc_aplwc(&m); + *p = memory_alloc_aplwc(&tmp_aplwc); if(*p == NULL) return APLWC_OUT_OF_MEMORY; - (*p)->memory = m; + memcpy(*p, &tmp_aplwc, sizeof(tmp_aplwc)); return aplwc_load_module(*p, "Boot", (const char *)boot_src, boot_src_len); } @@ -20,7 +20,7 @@ void aplwc_destroy(struct aplwc *p) { if(p) - memory_free_aplwc(&p->memory, p); + memory_free_aplwc(p, p); } const char * @@ -83,7 +83,7 @@ aplwc_read(struct aplwc *aplwc, const char *line) if(aplwc->last_error != APLWC_OK) return NULL; - ret = memory_alloc_aplwc_line(&aplwc->memory); + ret = memory_alloc_aplwc_line(aplwc); if(ret == NULL){ aplwc->last_error = APLWC_OUT_OF_MEMORY; return NULL; @@ -101,7 +101,7 @@ aplwc_free_line(struct aplwc_line *line) { if(line == NULL) return; - memory_free_aplwc_line(&line->aplwc->memory, line); + memory_free_aplwc_line(line->aplwc, line); } struct aplwc_value * @@ -116,7 +116,7 @@ aplwc_free_value(struct aplwc_value *value) { if(value == NULL) return; - memory_free_aplwc_value(&value->aplwc->memory, value); + memory_free_aplwc_value(value->aplwc, value); } const char * @@ -157,11 +157,11 @@ aplwc_load_module(struct aplwc *aplwc, const char *name, const char *src, int sr else{ error: if(tokens != NULL) - memory_free_token_list(&aplwc->memory, tokens); + memory_free_token_list(aplwc, tokens); if(text != NULL) - memory_free_string(&aplwc->memory, text); + memory_free_string(aplwc, text); if(namestr != NULL) - memory_free_string(&aplwc->memory, namestr); + memory_free_string(aplwc, namestr); return aplwc_last_error(aplwc); } } -- cgit v1.2.3