From fec2f4d9d1989feb0290dfcff416385ec4b97586 Mon Sep 17 00:00:00 2001 From: thing1 Date: Thu, 11 Jul 2024 13:33:42 +0100 Subject: finished vars, started work on the final zpy executable, still need to fix the parser though --- comp/lucas-standen-NEA/code/global/util.c | 4 +++- comp/lucas-standen-NEA/code/global/util.h | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'comp/lucas-standen-NEA/code/global') diff --git a/comp/lucas-standen-NEA/code/global/util.c b/comp/lucas-standen-NEA/code/global/util.c index 5f41dbc..dff05da 100644 --- a/comp/lucas-standen-NEA/code/global/util.c +++ b/comp/lucas-standen-NEA/code/global/util.c @@ -104,7 +104,9 @@ Vdef *isVdef(char *str){ Vdef *out = CheckedMalloc(sizeof(Vdef)); char *type; - out->id = strtok(str, ":"); + char *tmp = strtok(str, ":"); + out->id = CheckedMalloc(strlen(tmp)+1); + memcpy(out->id, tmp, strlen(tmp)+1); type = strtok(NULL, ":"); if (strcmp(type, "i64") == 0) out->type = TI64; diff --git a/comp/lucas-standen-NEA/code/global/util.h b/comp/lucas-standen-NEA/code/global/util.h index dc59460..130f823 100644 --- a/comp/lucas-standen-NEA/code/global/util.h +++ b/comp/lucas-standen-NEA/code/global/util.h @@ -1,11 +1,3 @@ -#include -#include -#include -#include -#include -#include -#include - // functions for user void Die(); // brings down the program -- cgit v1.2.3