Increased buffer size for regression tests:
authorbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 26 Aug 2001 18:01:33 +0000 (18:01 +0000)
committerbernhardheld <bernhardheld@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 26 Aug 2001 18:01:33 +0000 (18:01 +0000)
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

as/mcs51/asdata.c
as/mcs51/aslink.h
as/mcs51/asm.h
as/mcs51/asmain.c
as/mcs51/asnoice.c
as/mcs51/lklex.c
as/mcs51/lkmain.c
as/mcs51/lksym.c

index 3f1b071afa97d27757860d8a82468a84019dcb3c..f952d961ed965135eac49ab3399e547da9e6ea2e 100644 (file)
@@ -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
                                 */
index 51b61bf2cf14b5bd0087ffcfde26ea86a99c048d..7b1df7b5258a3c268aa1d0605ce3ea63233c8391 100644 (file)
 
 #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
index cffafad1ef14594bff3173d4ca6bac3bd60871d5..9134686a699d2e6d6794517dbc4231a23cfd0c41 100644 (file)
@@ -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
index ef6534afef8304862812bf10800e3dc75f5b2deb..9947ae3faa547f104ebad0d7ffbf88c000137b07 100644 (file)
@@ -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;
index e7a38e88165ee1448d25983c750bee8fac05dc92..a61449694b01aa9ddc5751d9ed49936857e350a3 100644 (file)
@@ -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;
index d7e4271bc94faed6e010008f6aec6a64926e3464..1992a7282bd02076f01dea62b0b86d54b9e4a510 100644 (file)
@@ -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;
 }
 
index 66464a45b2c880f69cfaf1129bb5f24099732293..17277c2fcee548eae31eaa76ccdcc79b64524868 100644 (file)
@@ -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;      
index d72f0614edbba80b3cc38f1781d349a6d48bc168..229234c71b1007209df8079f48ff464203561c68 100644 (file)
@@ -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<n; i++) {
-               *q++ = 0;
-       }
        return (p);
 }