Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sort move fltab outside main and make it static, eli...



details:   https://anonhg.NetBSD.org/src/rev/b3dc4ee70ef6
branches:  trunk
changeset: 540789:b3dc4ee70ef6
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Dec 24 13:09:38 2002 +0000

description:
move fltab outside main and make it static, eliminate two memset()s
g/c superfluous extern definition for clist[] and ncols
make toutpath[] static

diffstat:

 usr.bin/sort/sort.c |  14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 31bcb8be31e1 -r b3dc4ee70ef6 usr.bin/sort/sort.c
--- a/usr.bin/sort/sort.c       Tue Dec 24 12:29:28 2002 +0000
+++ b/usr.bin/sort/sort.c       Tue Dec 24 13:09:38 2002 +0000
@@ -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 @@
 #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 @@
 
 int REC_D = '\n';
 u_char d_mask[NBINS];          /* flags for rec_d, field_d, <blank> */
+
 /*
  * weight tables.  Gweights is one of ascii, Rascii..
  * modified to weight rec_d = 0 (or 255)
@@ -76,15 +77,14 @@
 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 @@
        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;



Home | Main Index | Thread Index | Old Index