From: bernhardheld Date: Sun, 26 Aug 2001 18:01:33 +0000 (+0000) Subject: Increased buffer size for regression tests: X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=37d822d9b33ac81c0f3098d16930ef6e37558fe1;p=fw%2Fsdcc Increased buffer size for regression tests: FILSPC (80) and NINPUT (128) replaced by FILENAME_MAX git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1175 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/as/mcs51/asdata.c b/as/mcs51/asdata.c index 3f1b071a..f952d961 100644 --- a/as/mcs51/asdata.c +++ b/as/mcs51/asdata.c @@ -51,13 +51,13 @@ int iflvl[MAXIF+1]; /* array of IF-ELSE-ENDIF flevel * values indexed by tlevel */ -char afn[FILSPC]; /* afile temporary file name +char afn[FILENAME_MAX]; /* afile temporary file name */ -char srcfn[MAXFIL][FILSPC]; /* array of source file names +char srcfn[MAXFIL][FILENAME_MAX]; /* array of source file names */ int srcline[MAXFIL]; /* source line number */ -char incfn[MAXINC][FILSPC]; /* array of include file names +char incfn[MAXINC][FILENAME_MAX]; /* array of include file names */ int incline[MAXINC]; /* include line number */ diff --git a/as/mcs51/aslink.h b/as/mcs51/aslink.h index 51b61bf2..7b1df7b5 100644 --- a/as/mcs51/aslink.h +++ b/as/mcs51/aslink.h @@ -86,12 +86,11 @@ #define NCPS 80 /* characters per symbol (JLH: change from 8) */ #define NDATA 16 /* actual data */ -#define NINPUT 128 /* Input buffer size */ +#define NINPUT FILENAME_MAX /* Input buffer size (BH: change from 128) */ #define NHASH 64 /* Buckets in hash table */ #define HMASK 077 /* Hash mask */ #define NLPP 60 /* Lines per page */ #define NTXT 16 /* T values */ -#define FILSPC 80 /* File spec length */ /* * The "R_" relocation constants define values used in diff --git a/as/mcs51/asm.h b/as/mcs51/asm.h index cffafad1..9134686a 100644 --- a/as/mcs51/asm.h +++ b/as/mcs51/asm.h @@ -85,7 +85,7 @@ #define NCPS 80 /* Chars. per symbol (JLH: change from 8) */ #define HUGE 1000 /* A huge number */ #define NERR 3 /* Errors per line */ -#define NINPUT 128 /* Input buffer size */ +#define NINPUT FILENAME_MAX /* Input buffer size (BH: change from 128) */ #define NCODE 128 /* Listing code buffer size */ #define NTITL 64 /* Title buffer size */ #define NSBTL 64 /* SubTitle buffer size */ @@ -95,7 +95,6 @@ #define MAXFIL 6 /* Maximum command line input files */ #define MAXINC 6 /* Maximum nesting of include files */ #define MAXIF 10 /* Maximum nesting of if/else/endif */ -#define FILSPC 80 /* Chars. in filespec */ #define NLIST 0 /* No listing */ #define SLIST 1 /* Source only */ @@ -371,16 +370,16 @@ extern int iflvl[MAXIF+1]; /* array of IF-ELSE-ENDIF flevel * values indexed by tlevel */ extern char - afn[FILSPC]; /* afile() temporary filespec + afn[FILENAME_MAX]; /* afile() temporary filespec */ extern char - srcfn[MAXFIL][FILSPC]; /* array of source file names + srcfn[MAXFIL][FILENAME_MAX]; /* array of source file names */ extern int srcline[MAXFIL]; /* current source file line */ extern char - incfn[MAXINC][FILSPC]; /* array of include file names + incfn[MAXINC][FILENAME_MAX]; /* array of include file names */ extern int incline[MAXINC]; /* current include file line diff --git a/as/mcs51/asmain.c b/as/mcs51/asmain.c index ef6534af..9947ae3f 100644 --- a/as/mcs51/asmain.c +++ b/as/mcs51/asmain.c @@ -479,7 +479,7 @@ asmbl() struct expr e1; char id[NCPS]; char opt[NCPS]; - char fn[FILSPC]; + char fn[FILENAME_MAX]; char *p; int d, n, uaf, uf; @@ -911,7 +911,7 @@ loop: d = getnb(); p = fn; while ((c = get()) != d) { - if (p < &fn[FILSPC-1]) { + if (p < &fn[FILENAME_MAX-1]) { *p++ = c; } else { break; @@ -1053,8 +1053,8 @@ int wf; p2 = strrchr (afn, FSEPX); // search last '.' if (!p2) p2 = afn + strlen (afn); - if (p2 > &afn[FILSPC-4]) // truncate filename, if it's too long - p2 = &afn[FILSPC-4]; + if (p2 > &afn[FILENAME_MAX-4]) // truncate filename, if it's too long + p2 = &afn[FILENAME_MAX-4]; *p2++ = FSEPX; // choose a file-extension @@ -1067,7 +1067,7 @@ int wf; } while ((c = *p3++) != 0) { // strncpy - if (p2 < &afn[FILSPC-1]) + if (p2 < &afn[FILENAME_MAX-1]) *p2++ = c; } *p2++ = 0; diff --git a/as/mcs51/asnoice.c b/as/mcs51/asnoice.c index e7a38e88..a6144969 100644 --- a/as/mcs51/asnoice.c +++ b/as/mcs51/asnoice.c @@ -17,7 +17,7 @@ static char* BaseFileName( int fileNumber ); char* BaseFileName( int fileNumber ) { static int prevFile = -1; - static char baseName[ FILSPC ]; + static char baseName[ FILENAME_MAX ]; char *p1, *p2; @@ -85,7 +85,7 @@ void DefineNoICE_Line() { static int prevFile = -1; static struct area *pPrevArea = NULL; - static char baseName[ FILSPC ]; + static char baseName[ FILENAME_MAX ]; int j; char *p1, *p2; diff --git a/as/mcs51/lklex.c b/as/mcs51/lklex.c index d7e4271b..1992a728 100644 --- a/as/mcs51/lklex.c +++ b/as/mcs51/lklex.c @@ -97,7 +97,7 @@ char *id; /*)Function VOID getfid(fid,c) * * char * str a pointer to a string of - * maximum length FILSPC + * maximum length FILENAME_MAX * int c this is first character to * copy to the string buffer * @@ -105,9 +105,9 @@ char *id; * from the current position copying the next string * into the external string buffer (str). The string ends when a * non SPACE type character is found. The maximum number of - * characters copied is FILSPC. If the input string is larger than - * FILSPC characters then the string is truncated, if the input string - * is shorter than FILSPC characters then the string is NULL filled. + * characters copied is FILENAME_MAX. If the input string is larger than + * FILENAME_MAX characters then the string is truncated, if the input string + * is shorter than FILENAME_MAX characters then the string is NULL filled. * * local variables: * char * p pointer to external string buffer @@ -136,11 +136,11 @@ char *str; p = str; do { - if (p < &str[FILSPC-1]) + if (p < &str[FILENAME_MAX-1]) *p++ = c; c = get(); } while (c && ((ctype[c] != SPACE)||(c == ':')||(c == '\\'))); - while (p < &str[FILSPC]) + while (p < &str[FILENAME_MAX]) *p++ = 0; } diff --git a/as/mcs51/lkmain.c b/as/mcs51/lkmain.c index 66464a45..17277c2f 100644 --- a/as/mcs51/lkmain.c +++ b/as/mcs51/lkmain.c @@ -1045,14 +1045,14 @@ char *ft; register char *p1, *p2, *p3; register int c; FILE *fp; - char fb[FILSPC]; + char fb[FILENAME_MAX]; char *omode = (wf ? (wf == 2 ? "a" : "w") : "r"); p1 = fn; p2 = fb; p3 = ft; while ((c = *p1++) != 0 && c != FSEPX) { - if (p2 < &fb[FILSPC-4]) + if (p2 < &fb[FILENAME_MAX-4]) *p2++ = c; } *p2++ = FSEPX; @@ -1064,7 +1064,7 @@ char *ft; } } while ((c = *p3++) != 0) { - if (p2 < &fb[FILSPC-1]) + if (p2 < &fb[FILENAME_MAX-1]) *p2++ = c; } *p2++ = 0; diff --git a/as/mcs51/lksym.c b/as/mcs51/lksym.c index d72f0614..229234c7 100644 --- a/as/mcs51/lksym.c +++ b/as/mcs51/lksym.c @@ -477,15 +477,11 @@ VOID * new(n) unsigned int n; { - register char *p,*q; - register unsigned int i; + register char *p; - if ((p = (char *) malloc(n)) == NULL) { + if ((p = (char *) calloc(n, 1)) == NULL) { fprintf(stderr, "Out of space!\n"); lkexit(1); } - for (i=0,q=p; i