sys/boot: use our nitems() macro when it is available through param.h.

No functional change, only trivial cases are done in this sweep,

Discussed in:	freebsd-current
This commit is contained in:
pfg 2016-04-19 23:44:33 +00:00
parent be4082c832
commit 99e9a53c81
4 changed files with 4 additions and 4 deletions

View File

@ -104,7 +104,7 @@ parttype2str(enum partition_type type)
{
size_t i;
for (i = 0; i < sizeof(ptypes) / sizeof(ptypes[0]); i++)
for (i = 0; i < nitems(ptypes); i++)
if (ptypes[i].type == type)
return (ptypes[i].desc);
return (ptypes[0].desc);

View File

@ -445,7 +445,7 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp)
/* Do relocation fixup on metadata of each module. */
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
for (i = 0; i < sizeof mdt / sizeof mdt[0]; i++) {
for (i = 0; i < nitems(mdt); i++) {
md = file_findmetadata(xp, mdt[i]);
if (md) {
bcopy(md->md_data, &vaddr, sizeof vaddr);

View File

@ -116,7 +116,7 @@ static const unsigned char flags[NOPT] = {
/* These must match BOOTINFO_DEV_TYPE constants. */
static const char *const dev_nm[] = {"dram", "cfi", "sdcard"};
static const u_int dev_nm_count = sizeof(dev_nm) / sizeof(dev_nm[0]);
static const u_int dev_nm_count = nitems(dev_nm);
static struct dmadat __dmadat;

View File

@ -349,7 +349,7 @@ md_load(char *args, vm_offset_t *modulep)
/* Do relocation fixup on metadata of each module. */
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) {
for (i = 0; i < sizeof mdt / sizeof mdt[0]; i++) {
for (i = 0; i < nitems(mdt); i++) {
md = file_findmetadata(xp, mdt[i]);
if (md) {
bcopy(md->md_data, &vaddr, sizeof vaddr);