Current-Users archive

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

Re: CVS commit: src/usr.sbin/sa (main.c:1.23)



On Saturday 2009-04-18 13:37 +0000, Luke Mewburn caused:
:Module Name:   src
:Committed By:  lukem
:Date:          Sat Apr 18 13:37:05 UTC 2009
:Modified Files:
:       src/usr.sbin/sa: main.c pdb.c
:Log Message:
:Fix WARNS=4 issues (-Wcast-qual -Wsign-compare).
:XXX: could improve parsing of -v option and store "cutoff" as a uint64_t.
:To generate a diff of this commit:
:cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/sa/main.c

------------------------------------------------------------
@@ -76,7 +76,7 @@
 int Kflag, lflag, mflag, qflag, rflag, sflag, tflag, uflag, vflag;
 int cutoff = 1;
 
-static char    *dfltargv[] = { _PATH_ACCT };
+static char    *dfltargv[] = { __UNCONST(_PATH_ACCT), 0 };
 static int     dfltargc = (sizeof(dfltargv)/sizeof(char *));
 
 /* default to comparing by sum of user + system time */
------------------------------------------------------------

This is a functional change.  You added an element to dfltargv
which changed the dfltargc value so that it processes too many
values.  Also, I don't know why you did __UNCONST there except
that it was easiest.  The dfltargv/dfltargc are constant so maybe
something like the following is appropriate.

Regards,
Geoff


Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/sa/main.c,v
retrieving revision 1.23
diff -u -r1.23 main.c
--- main.c      18 Apr 2009 13:37:04 -0000      1.23
+++ main.c      28 Apr 2009 01:45:46 -0000
@@ -76,8 +76,8 @@
 int Kflag, lflag, mflag, qflag, rflag, sflag, tflag, uflag, vflag;
 int cutoff = 1;
 
-static char    *dfltargv[] = { __UNCONST(_PATH_ACCT), 0 };
-static int     dfltargc = (sizeof(dfltargv)/sizeof(char *));
+static char const * const dfltargv[] = { _PATH_ACCT };
+static const int dfltargc = (sizeof(dfltargv)/sizeof(char *));
 
 /* default to comparing by sum of user + system time */
 cmpf_t   sa_cmp = cmp_usrsys;
@@ -201,7 +201,7 @@
 
        if (argc == 0) {
                argc = dfltargc;
-               argv = dfltargv;
+               argv = __UNCONST(dfltargv);
        }
 
        /* for each file specified */


Home | Main Index | Thread Index | Old Index