Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2017 04:49:40 +0000 (UTC)
From:      Marcelo Araujo <araujo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314989 - head/usr.bin/vmstat
Message-ID:  <201703100449.v2A4neTK046456@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: araujo
Date: Fri Mar 10 04:49:40 2017
New Revision: 314989
URL: https://svnweb.freebsd.org/changeset/base/314989

Log:
  Use nitems() from sys/param.h and also remove the cast.
  
  Reviewed by:	markj
  MFC after:	3 weeks.
  Differential Revision:	https://reviews.freebsd.org/D9937

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==============================================================================
--- head/usr.bin/vmstat/vmstat.c	Fri Mar 10 04:30:31 2017	(r314988)
+++ head/usr.bin/vmstat/vmstat.c	Fri Mar 10 04:49:40 2017	(r314989)
@@ -288,17 +288,13 @@ retry_nlist:
 				namelist[X_SUM].n_name = "_cnt";
 				goto retry_nlist;
 			}
-			for (c = 0;
-			     c < (int)(sizeof(namelist)/sizeof(namelist[0]));
-			     c++)
+			for (c = 0; c < nitems(namelist); c++)
 				if (namelist[c].n_type == 0)
 					bufsize += strlen(namelist[c].n_name) + 1;
 			bufsize += len + 1;
 			buf = bp = alloca(bufsize);
 
-			for (c = 0;
-			     c < (int)(sizeof(namelist)/sizeof(namelist[0]));
-			     c++)
+			for (c = 0; c < nitems(namelist); c++)
 				if (namelist[c].n_type == 0) {
 					xo_error(" %s",
 					    namelist[c].n_name);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703100449.v2A4neTK046456>