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

Diff for /src/usr.bin/column/column.c between version 1.9 and 1.10

version 1.9, 2003/06/10 22:20:45 version 1.10, 2003/09/26 22:24:09
Line 212 
Line 212 
         TBL *t;          TBL *t;
         int coloff, cnt;          int coloff, cnt;
         char *p, **lp;          char *p, **lp;
         int *lens, maxcols;          int *lens, *lens2, maxcols;
         TBL *tbl;          TBL *tbl;
         char **cols;          char **cols, **cols2;
   
         t = tbl = emalloc(entries * sizeof(TBL));          t = tbl = emalloc(entries * sizeof(TBL));
         cols = emalloc((maxcols = DEFCOLS) * sizeof(char *));          cols = emalloc((maxcols = DEFCOLS) * sizeof(char *));
Line 223 
Line 223 
                 for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator));                  for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator));
                     p = NULL)                      p = NULL)
                         if (++coloff == maxcols) {                          if (++coloff == maxcols) {
                                 if (!(cols = realloc(cols, (u_int)maxcols +                                  if (!(cols2 = realloc(cols, (u_int)maxcols +
                                     DEFCOLS * sizeof(char *))) ||                                      DEFCOLS * sizeof(char *))) ||
                                     !(lens = realloc(lens,                                      !(lens2 = realloc(lens,
                                     (u_int)maxcols + DEFCOLS * sizeof(int))))                                      (u_int)maxcols + DEFCOLS * sizeof(int))))
                                         err(1, NULL);                                          err(1, NULL);
                                   cols = cols2;
                                   lens = lens2;
                                 memset((char *)lens + maxcols * sizeof(int),                                  memset((char *)lens + maxcols * sizeof(int),
                                     0, DEFCOLS * sizeof(int));                                      0, DEFCOLS * sizeof(int));
                                 maxcols += DEFCOLS;                                  maxcols += DEFCOLS;

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10