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
This commit is contained in:
Marcelo Araujo 2017-03-10 04:49:40 +00:00
parent 807bd0d9f0
commit 4e7ecee633

View File

@ -288,17 +288,13 @@ main(int argc, char *argv[])
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);