[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.10 and 1.11

version 1.10, 2003/09/26 22:24:09 version 1.11, 2006/03/10 19:14:58
Line 55 
Line 55 
 #include <unistd.h>  #include <unistd.h>
   
 void  c_columnate(void);  void  c_columnate(void);
 void *emalloc(int);  void *emalloc(size_t);
 void  input(FILE *);  void  input(FILE *);
 void  maketbl(void);  void  maketbl(void);
 void  print(void);  void  print(void);
Line 230 
Line 230 
                                         err(1, NULL);                                          err(1, NULL);
                                 cols = cols2;                                  cols = cols2;
                                 lens = lens2;                                  lens = lens2;
                                 memset((char *)lens + maxcols * sizeof(int),                                  memset(lens + maxcols, 0,
                                     0, DEFCOLS * sizeof(int));                                      DEFCOLS * sizeof(int));
                                 maxcols += DEFCOLS;                                  maxcols += DEFCOLS;
                         }                          }
                 t->list = emalloc(coloff * sizeof(char *));                  t->list = emalloc(coloff * sizeof(char *));
Line 257 
Line 257 
 void  void
 input(FILE *fp)  input(FILE *fp)
 {  {
         static int maxentry;          static size_t maxentry;
         int len;          int len;
         char *p, buf[MAXLINELEN];          char *p, buf[MAXLINELEN];
   
Line 277 
Line 277 
                 if (maxlength < len)                  if (maxlength < len)
                         maxlength = len;                          maxlength = len;
                 if (entries == maxentry) {                  if (entries == maxentry) {
                         maxentry += DEFNUM;                          char **nlist;
                         if (!(list = realloc(list,                          size_t nsize = maxentry + DEFNUM;
                             (u_int)maxentry * sizeof(char *))))  
                           if (!(nlist = realloc(list, nsize * sizeof(char *))))
                                 err(1, NULL);                                  err(1, NULL);
                           list = nlist;
                           maxentry = nsize;
                 }                  }
                 list[entries++] = strdup(buf);                  if (!(list[entries++] = strdup(buf)))
                           err(1, NULL);
         }          }
 }  }
   
 void *  void *
 emalloc(int size)  emalloc(size_t size)
 {  {
         char *p;          void *p;
   
         if (!(p = malloc(size)))          if (!(p = malloc(size)))
                 err(1, NULL);                  err(1, NULL);

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