removed limit on string size
This commit is contained in:
parent
05db577e01
commit
6d675af42c
2 changed files with 12 additions and 4 deletions
|
@ -9,6 +9,8 @@ fillem.c
|
||||||
gencode.c
|
gencode.c
|
||||||
glosym.c
|
glosym.c
|
||||||
glosym.h
|
glosym.h
|
||||||
|
label.c
|
||||||
|
label.h
|
||||||
main.c
|
main.c
|
||||||
move.c
|
move.c
|
||||||
nextem.c
|
nextem.c
|
||||||
|
|
|
@ -57,8 +57,6 @@ long con();
|
||||||
|
|
||||||
#define get8() getc(emfile)
|
#define get8() getc(emfile)
|
||||||
|
|
||||||
#define MAXSTR 256
|
|
||||||
|
|
||||||
FILE *emfile;
|
FILE *emfile;
|
||||||
extern FILE *codefile;
|
extern FILE *codefile;
|
||||||
extern FILE *freopen();
|
extern FILE *freopen();
|
||||||
|
@ -68,7 +66,8 @@ int opcode;
|
||||||
int offtyp;
|
int offtyp;
|
||||||
long argval;
|
long argval;
|
||||||
int dlbval;
|
int dlbval;
|
||||||
char str[MAXSTR],argstr[128],labstr[128];
|
char *str,argstr[128],labstr[128];
|
||||||
|
unsigned int maxstrsiz;
|
||||||
int strsiz;
|
int strsiz;
|
||||||
int holno=0;
|
int holno=0;
|
||||||
int procno=0;
|
int procno=0;
|
||||||
|
@ -90,6 +89,7 @@ string tostring();
|
||||||
string holstr();
|
string holstr();
|
||||||
string strarg();
|
string strarg();
|
||||||
string mystrcpy();
|
string mystrcpy();
|
||||||
|
string myalloc();
|
||||||
long get32();
|
long get32();
|
||||||
|
|
||||||
in_init(filename) char *filename; {
|
in_init(filename) char *filename; {
|
||||||
|
@ -99,6 +99,7 @@ in_init(filename) char *filename; {
|
||||||
error("Can't open %s",filename);
|
error("Can't open %s",filename);
|
||||||
if (get16()!=sp_magic)
|
if (get16()!=sp_magic)
|
||||||
error("Bad format %s",filename ? filename : "standard-input");
|
error("Bad format %s",filename ? filename : "standard-input");
|
||||||
|
str = myalloc(maxstrsiz=256);
|
||||||
}
|
}
|
||||||
|
|
||||||
in_start() {
|
in_start() {
|
||||||
|
@ -517,8 +518,13 @@ getstring() {
|
||||||
register n;
|
register n;
|
||||||
|
|
||||||
getarg(cst_ptyp);
|
getarg(cst_ptyp);
|
||||||
if (argval < 0 || argval > MAXSTR-1)
|
if (argval < 0)
|
||||||
fatal("string/identifier too long");
|
fatal("string/identifier too long");
|
||||||
|
if (argval >= maxstrsiz) {
|
||||||
|
myfree(str);
|
||||||
|
str = myalloc((unsigned) argval + 1);
|
||||||
|
maxstrsiz = argval + 1;
|
||||||
|
}
|
||||||
strsiz = n = (int) argval;
|
strsiz = n = (int) argval;
|
||||||
p = str;
|
p = str;
|
||||||
while (--n >= 0)
|
while (--n >= 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue