[BACK]Return to misc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / m4

Diff for /src/usr.bin/m4/misc.c between version 1.16 and 1.17

version 1.16, 2000/01/13 17:35:10 version 1.17, 2000/01/15 14:26:00
Line 66 
Line 66 
 static size_t bufsize = BUFSIZE;  static size_t bufsize = BUFSIZE;
 static int low_sp = 0;  static int low_sp = 0;
   
 pbent *buf;                     /* push-back buffer            */  char *buf;                      /* push-back buffer            */
 pbent *bufbase;                 /* the base for current ilevel */  char *bufbase;                  /* the base for current ilevel */
 pbent *bbase[MAXINP];           /* the base for each ilevel    */  char *bbase[MAXINP];            /* the base for each ilevel    */
 pbent *bp;                      /* first available character   */  char *bp;                       /* first available character   */
 static pbent *endpbb;                   /* end of push-back buffer     */  static char *endpbb;                    /* end of push-back buffer     */
   
   
 static void enlarge_bufspace __P((void));  static void enlarge_bufspace __P((void));
Line 96 
Line 96 
  */   */
 void  void
 putback(c)  putback(c)
         pbent c;          int c;
 {  {
           if (c == EOF)
                   return;
         if (bp >= endpbb)          if (bp >= endpbb)
                 enlarge_bufspace();                  enlarge_bufspace();
         *bp++ = c;          *bp++ = c;
Line 149 
Line 151 
         strspace = xalloc(strsize+1);          strspace = xalloc(strsize+1);
         ep = strspace;          ep = strspace;
         endest = strspace+strsize;          endest = strspace+strsize;
         buf = (pbent *)xalloc(bufsize * sizeof(pbent));          buf = (char *)xalloc(bufsize);
         bufbase = buf;          bufbase = buf;
         bp = buf;          bp = buf;
         endpbb = buf + bufsize;          endpbb = buf + bufsize;
Line 162 
Line 164 
  * duplicate it transparently, and to reclaim the correct   * duplicate it transparently, and to reclaim the correct
  * space when the stack is unwound.   * space when the stack is unwound.
  */   */
 static  static void
 void enlarge_strspace()  enlarge_strspace()
 {  {
         char *newstrspace;          char *newstrspace;
   
Line 182 
Line 184 
         endest = strspace + strsize;          endest = strspace + strsize;
 }  }
   
 static  static void
 void enlarge_bufspace()  enlarge_bufspace()
 {  {
         pbent *newbuf;          char *newbuf;
         int i;          int i;
   
         bufsize *= 2;          bufsize *= 2;
         newbuf = realloc(buf, bufsize*sizeof(pbent));          newbuf = realloc(buf, bufsize);
         if (!newbuf)          if (!newbuf)
                 errx(1, "too many characters pushed back");                  errx(1, "too many characters pushed back");
         for (i = 0; i < MAXINP; i++)          for (i = 0; i < MAXINP; i++)
Line 299 
Line 301 
 obtain_char(f)  obtain_char(f)
         struct input_file *f;          struct input_file *f;
 {  {
         if (f->c == '\n')          if (f->c == EOF)
                   return EOF;
           else if (f->c == '\n')
                 f->lineno++;                  f->lineno++;
   
         f->c = fgetc(f->file);          f->c = fgetc(f->file);
Line 324 
Line 328 
 {  {
         if (f->file != stdin)          if (f->file != stdin)
             fclose(f->file);              fclose(f->file);
           f->c = EOF;
         /*          /*
          * XXX can't free filename, as there might still be           * XXX can't free filename, as there might still be
          * error information pointing to it.           * error information pointing to it.

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17