From 77d4ae97dfe759748f31caa082923c995a3c963e Mon Sep 17 00:00:00 2001 From: jdolecek Date: Tue, 24 Dec 2002 13:09:38 +0000 Subject: [PATCH] move fltab outside main and make it static, eliminate two memset()s g/c superfluous extern definition for clist[] and ncols make toutpath[] static --- usr.bin/sort/sort.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index dfe4e79aae9c..884dc48b6b69 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -1,4 +1,4 @@ -/* $NetBSD: sort.c,v 1.29 2002/11/27 16:47:13 tron Exp $ */ +/* $NetBSD: sort.c,v 1.30 2002/12/24 13:09:38 jdolecek Exp $ */ /*- * Copyright (c) 1993 @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\ #endif /* not lint */ #ifndef lint -__RCSID("$NetBSD: sort.c,v 1.29 2002/11/27 16:47:13 tron Exp $"); +__RCSID("$NetBSD: sort.c,v 1.30 2002/12/24 13:09:38 jdolecek Exp $"); __SCCSID("@(#)sort.c 8.1 (Berkeley) 6/6/93"); #endif /* not lint */ @@ -68,6 +68,7 @@ __SCCSID("@(#)sort.c 8.1 (Berkeley) 6/6/93"); int REC_D = '\n'; u_char d_mask[NBINS]; /* flags for rec_d, field_d, */ + /* * weight tables. Gweights is one of ascii, Rascii.. * modified to weight rec_d = 0 (or 255) @@ -76,15 +77,14 @@ u_char ascii[NBINS], Rascii[NBINS], RFtable[NBINS], Ftable[NBINS]; int SINGL_FLD = 0, SEP_FLAG = 0, UNIQUE = 0; struct coldesc clist[(ND+1)*2]; int ncols = 0; -extern struct coldesc clist[(ND+1)*2]; -extern int ncols; /* * Default to stable sort. */ int stable_sort = 1; -char toutpath[MAXPATHLEN]; +static char toutpath[MAXPATHLEN]; +static struct field fldtab[ND+2]; const char *tmpdir; /* where temporary files should be put */ @@ -104,14 +104,12 @@ main(argc, argv) int ch, i, stdinflag = 0, tmp = 0; char cflag = 0, mflag = 0; char *outfile, *outpath = 0; - struct field fldtab[ND+2], *ftpos; + struct field *ftpos; struct filelist filelist; FILE *outfp = NULL; setlocale(LC_ALL, ""); - memset(fldtab, 0, (ND+2)*sizeof(struct field)); - memset(d_mask, 0, NBINS); d_mask[REC_D = '\n'] = REC_D_F; SINGL_FLD = SEP_FLAG = 0; d_mask['\t'] = d_mask[' '] = BLANK | FLD_D;