From 6d675af42cfc7c0d49c743105a3f3b9ae033560b Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 30 Jul 1990 15:40:08 +0000 Subject: [PATCH] removed limit on string size --- mach/proto/ncg/.distr | 2 ++ mach/proto/ncg/fillem.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mach/proto/ncg/.distr b/mach/proto/ncg/.distr index cf85682ac..c81c994cc 100644 --- a/mach/proto/ncg/.distr +++ b/mach/proto/ncg/.distr @@ -9,6 +9,8 @@ fillem.c gencode.c glosym.c glosym.h +label.c +label.h main.c move.c nextem.c diff --git a/mach/proto/ncg/fillem.c b/mach/proto/ncg/fillem.c index c5aa71cbd..98ba4107c 100644 --- a/mach/proto/ncg/fillem.c +++ b/mach/proto/ncg/fillem.c @@ -57,8 +57,6 @@ long con(); #define get8() getc(emfile) -#define MAXSTR 256 - FILE *emfile; extern FILE *codefile; extern FILE *freopen(); @@ -68,7 +66,8 @@ int opcode; int offtyp; long argval; int dlbval; -char str[MAXSTR],argstr[128],labstr[128]; +char *str,argstr[128],labstr[128]; +unsigned int maxstrsiz; int strsiz; int holno=0; int procno=0; @@ -90,6 +89,7 @@ string tostring(); string holstr(); string strarg(); string mystrcpy(); +string myalloc(); long get32(); in_init(filename) char *filename; { @@ -99,6 +99,7 @@ in_init(filename) char *filename; { error("Can't open %s",filename); if (get16()!=sp_magic) error("Bad format %s",filename ? filename : "standard-input"); + str = myalloc(maxstrsiz=256); } in_start() { @@ -517,8 +518,13 @@ getstring() { register n; getarg(cst_ptyp); - if (argval < 0 || argval > MAXSTR-1) + if (argval < 0) fatal("string/identifier too long"); + if (argval >= maxstrsiz) { + myfree(str); + str = myalloc((unsigned) argval + 1); + maxstrsiz = argval + 1; + } strsiz = n = (int) argval; p = str; while (--n >= 0) -- 2.34.1