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

Diff for /src/usr.bin/awk/tran.c between version 1.25 and 1.26

version 1.25, 2020/06/10 21:04:40 version 1.26, 2020/06/10 21:05:02
Line 529 
Line 529 
         if (p == NULL)          if (p == NULL)
                 FATAL("out of space concatenating %s and %s", sa, sb);                  FATAL("out of space concatenating %s and %s", sa, sb);
         snprintf(p, l, "%s%s", sa, sb);          snprintf(p, l, "%s%s", sa, sb);
         char *newbuf = malloc(strlen(p) + 2);  
           l++;    // add room for ' '
           char *newbuf = malloc(l);
         if (newbuf == NULL)          if (newbuf == NULL)
                 FATAL("out of space concatenating %s and %s", sa, sb);                  FATAL("out of space concatenating %s and %s", sa, sb);
         // See string() in lex.c; a string "xx" is stored in the symbol          // See string() in lex.c; a string "xx" is stored in the symbol
         // table as "xx ".          // table as "xx ".
         sprintf(newbuf, "%s ", p);          snprintf(newbuf, l, "%s ", p);
         c = setsymtab(newbuf, p, 0.0, CON|STR|DONTFREE, symtab);          c = setsymtab(newbuf, p, 0.0, CON|STR|DONTFREE, symtab);
         free(p);          free(p);
         free(newbuf);          free(newbuf);

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26