From 18f545f3c954cea701009811b892278161fcf190 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 27 Mar 2024 09:21:34 -0700 Subject: [PATCH] (uxnasm) Starting to merge buffers --- src/uxnasm.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/uxnasm.c b/src/uxnasm.c index aab26ae..fe39f90 100644 --- a/src/uxnasm.c +++ b/src/uxnasm.c @@ -24,7 +24,7 @@ typedef struct { } Macro; typedef struct { - char name[0x40]; + char *name; Uint16 addr, refs; } Label; @@ -73,6 +73,18 @@ static char *scat(char *dst, char *src) { char *ptr = dst + slen(dst); while(*sr /* clang-format on */ +char storage[0x10000], *storenext = storage; + +static char * +store(char *s) +{ + char *ptr = storenext; + while((*storenext++ = *s++)) + ; + *storenext++ = 0; + return ptr; +} + static int parse(char *w, FILE *f); static char *makesublabel(char *src, char *name); @@ -180,7 +192,7 @@ makelabel(char *name, int setscope) l = &p.labels[p.label_len++]; l->addr = p.ptr; l->refs = 0; - scpy(name, l->name, 0x40); + l->name = store(name); if(setscope) { int i = 0; while(name[i] != '/' && i < 0x3e && (scope[i] = name[i])) i++;