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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to