svn commit: r304225 - head/usr.bin/systat
Marcelo Araujo
araujo at FreeBSD.org
Tue Aug 16 15:52:11 UTC 2016
Author: araujo
Date: Tue Aug 16 15:52:10 2016
New Revision: 304225
URL: https://svnweb.freebsd.org/changeset/base/304225
Log:
Use nitems() from sys/param.h.
MFC after: 2 weeks.
Modified:
head/usr.bin/systat/main.c
Modified: head/usr.bin/systat/main.c
==============================================================================
--- head/usr.bin/systat/main.c Tue Aug 16 15:17:36 2016 (r304224)
+++ head/usr.bin/systat/main.c Tue Aug 16 15:52:10 2016 (r304225)
@@ -261,7 +261,7 @@ display(void)
int i, j;
/* Get the load average over the last minute. */
- (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
+ (void) getloadavg(avenrun, nitems(avenrun));
(*curcmd->c_fetch)();
if (curcmd->c_flags & CF_LOADAV) {
j = 5.0*avenrun[0] + 0.5;
@@ -293,7 +293,7 @@ display(void)
GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]);
GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]);
wmove(wload, 0, 0); wclrtoeol(wload);
- for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) {
+ for (i = 0 ; i < nitems(arc); i++) {
if (arc[i] > 10llu * 1024 * 1024 * 1024 ) {
wprintw(wload, "%7lluG", arc[i] >> 30);
}
@@ -318,7 +318,7 @@ void
load(void)
{
- (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0]));
+ (void) getloadavg(avenrun, nitems(avenrun));
mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
avenrun[0], avenrun[1], avenrun[2]);
clrtoeol();
More information about the svn-src-head
mailing list