=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/column/column.c,v retrieving revision 1.9 retrieving revision 1.10 diff -c -r1.9 -r1.10 *** src/usr.bin/column/column.c 2003/06/10 22:20:45 1.9 --- src/usr.bin/column/column.c 2003/09/26 22:24:09 1.10 *************** *** 1,4 **** ! /* $OpenBSD: column.c,v 1.9 2003/06/10 22:20:45 deraadt Exp $ */ /* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: column.c,v 1.10 2003/09/26 22:24:09 tedu Exp $ */ /* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */ /* *************** *** 40,46 **** #if 0 static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; #endif ! static char rcsid[] = "$OpenBSD: column.c,v 1.9 2003/06/10 22:20:45 deraadt Exp $"; #endif /* not lint */ #include --- 40,46 ---- #if 0 static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95"; #endif ! static char rcsid[] = "$OpenBSD: column.c,v 1.10 2003/09/26 22:24:09 tedu Exp $"; #endif /* not lint */ #include *************** *** 212,220 **** TBL *t; int coloff, cnt; char *p, **lp; ! int *lens, maxcols; TBL *tbl; ! char **cols; t = tbl = emalloc(entries * sizeof(TBL)); cols = emalloc((maxcols = DEFCOLS) * sizeof(char *)); --- 212,220 ---- TBL *t; int coloff, cnt; char *p, **lp; ! int *lens, *lens2, maxcols; TBL *tbl; ! char **cols, **cols2; t = tbl = emalloc(entries * sizeof(TBL)); cols = emalloc((maxcols = DEFCOLS) * sizeof(char *)); *************** *** 223,233 **** for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator)); p = NULL) if (++coloff == maxcols) { ! if (!(cols = realloc(cols, (u_int)maxcols + DEFCOLS * sizeof(char *))) || ! !(lens = realloc(lens, (u_int)maxcols + DEFCOLS * sizeof(int)))) err(1, NULL); memset((char *)lens + maxcols * sizeof(int), 0, DEFCOLS * sizeof(int)); maxcols += DEFCOLS; --- 223,235 ---- for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator)); p = NULL) if (++coloff == maxcols) { ! if (!(cols2 = realloc(cols, (u_int)maxcols + DEFCOLS * sizeof(char *))) || ! !(lens2 = realloc(lens, (u_int)maxcols + DEFCOLS * sizeof(int)))) err(1, NULL); + cols = cols2; + lens = lens2; memset((char *)lens + maxcols * sizeof(int), 0, DEFCOLS * sizeof(int)); maxcols += DEFCOLS;