summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code/global
diff options
context:
space:
mode:
Diffstat (limited to 'comp/lucas-standen-NEA/code/global')
-rw-r--r--comp/lucas-standen-NEA/code/global/util.c4
-rw-r--r--comp/lucas-standen-NEA/code/global/util.h8
2 files changed, 3 insertions, 9 deletions
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 <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <error.h>
-#include <ctype.h>
-
// functions for user
void Die(); // brings down the program