[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.41 and 1.42

version 1.41, 2009/10/14 17:19:47 version 1.42, 2010/09/07 19:58:09
Line 57 
Line 57 
 unsigned char *buf;                     /* push-back buffer            */  unsigned char *buf;                     /* push-back buffer            */
 unsigned char *bufbase;                 /* the base for current ilevel */  unsigned char *bufbase;                 /* the base for current ilevel */
 unsigned char *bbase[MAXINP];           /* the base for each ilevel    */  unsigned char *bbase[MAXINP];           /* the base for each ilevel    */
 unsigned char *bp;                      /* first available character   */  unsigned char *bp;                      /* first available character   */
 unsigned char *endpbb;                  /* end of push-back buffer     */  unsigned char *endpbb;                  /* end of push-back buffer     */
   
   
Line 155 
Line 155 
         while ((n /= 10) > 0);          while ((n /= 10) > 0);
 }  }
   
 void  void
 initspaces()  initspaces()
 {  {
         int i;          int i;
Line 171 
Line 171 
                 bbase[i] = buf;                  bbase[i] = buf;
 }  }
   
 void  void
 enlarge_strspace()  enlarge_strspace()
 {  {
         char *newstrspace;          char *newstrspace;
Line 182 
Line 182 
         if (!newstrspace)          if (!newstrspace)
                 errx(1, "string space overflow");                  errx(1, "string space overflow");
         memcpy(newstrspace, strspace, strsize/2);          memcpy(newstrspace, strspace, strsize/2);
         for (i = 0; i <= sp; i++)          for (i = 0; i <= sp; i++)
                 if (sstack[i])                  if (sstack[i])
                         mstack[i].sstr = (mstack[i].sstr - strspace)                          mstack[i].sstr = (mstack[i].sstr - strspace)
                             + newstrspace;                              + newstrspace;
         ep = (ep-strspace) + newstrspace;          ep = (ep-strspace) + newstrspace;
         free(strspace);          free(strspace);
Line 214 
Line 214 
 void  void
 chrsave(int c)  chrsave(int c)
 {  {
         if (ep >= endest)          if (ep >= endest)
                 enlarge_strspace();                  enlarge_strspace();
         *ep++ = c;          *ep++ = c;
 }  }
Line 283 
Line 283 
 {  {
         int i;          int i;
   
         outfile = (FILE **)xrealloc(outfile, sizeof(FILE *) * n,          outfile = (FILE **)xrealloc(outfile, sizeof(FILE *) * n,
             "too many diverts %d", n);              "too many diverts %d", n);
         for (i = maxout; i < n; i++)          for (i = maxout; i < n; i++)
                 outfile[i] = NULL;                  outfile[i] = NULL;
Line 300 
Line 300 
                         err(1, "malloc");                          err(1, "malloc");
                 else {                  else {
                         va_list va;                          va_list va;
   
                         va_start(va, fmt);                          va_start(va, fmt);
                         verr(1, fmt, va);                          verr(1, fmt, va);
                         va_end(va);                          va_end(va);
Line 324 
Line 324 
                         va_start(va, fmt);                          va_start(va, fmt);
                         verr(1, fmt, va);                          verr(1, fmt, va);
                         va_end(va);                          va_end(va);
                 }                  }
         }          }
         return p;          return p;
 }  }
Line 347 
Line 347 
         exit(1);          exit(1);
 }  }
   
 int  int
 obtain_char(struct input_file *f)  obtain_char(struct input_file *f)
 {  {
         if (f->c == EOF)          if (f->c == EOF)
Line 360 
Line 360 
         return f->c;          return f->c;
 }  }
   
 void  void
 set_input(struct input_file *f, FILE *real, const char *name)  set_input(struct input_file *f, FILE *real, const char *name)
 {  {
         f->file = real;          f->file = real;
Line 378 
Line 378 
         infile[ilevel].synch_lineno = infile[ilevel].lineno;          infile[ilevel].synch_lineno = infile[ilevel].lineno;
 }  }
   
 void  void
 release_input(struct input_file *f)  release_input(struct input_file *f)
 {  {
         if (f->file != stdin)          if (f->file != stdin)
             fclose(f->file);              fclose(f->file);
         f->c = EOF;          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.
          */           */
 }  }
Line 404 
Line 404 
         pbstr(lquote);          pbstr(lquote);
 }  }
   
 /*  /*
  * buffer_mark/dump_buffer: allows one to save a mark in a buffer,   * buffer_mark/dump_buffer: allows one to save a mark in a buffer,
  * and later dump everything that was added since then to a file.   * and later dump everything that was added since then to a file.
  */   */

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42