diff options
author | pfg <pfg@FreeBSD.org> | 2016-04-19 23:44:33 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2016-04-19 23:44:33 +0000 |
commit | 99e9a53c8161ee4ae550ad18b73edd303a3724f4 (patch) | |
tree | afa86333c517a9bad7c58c8ff4b8c214ce386938 | |
parent | be4082c832ab3e8ed4b2d4877eb549a54174bf85 (diff) | |
download | FreeBSD-src-99e9a53c8161ee4ae550ad18b73edd303a3724f4.zip FreeBSD-src-99e9a53c8161ee4ae550ad18b73edd303a3724f4.tar.gz |
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
-rw-r--r-- | sys/boot/common/part.c | 2 | ||||
-rw-r--r-- | sys/boot/efi/loader/bootinfo.c | 2 | ||||
-rw-r--r-- | sys/boot/mips/beri/boot2/boot2.c | 2 | ||||
-rw-r--r-- | sys/boot/uboot/common/metadata.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/sys/boot/common/part.c b/sys/boot/common/part.c index b349e96..7761de3 100644 --- a/sys/boot/common/part.c +++ b/sys/boot/common/part.c @@ -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); diff --git a/sys/boot/efi/loader/bootinfo.c b/sys/boot/efi/loader/bootinfo.c index c6a76ab..1f45ea3 100644 --- a/sys/boot/efi/loader/bootinfo.c +++ b/sys/boot/efi/loader/bootinfo.c @@ -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); diff --git a/sys/boot/mips/beri/boot2/boot2.c b/sys/boot/mips/beri/boot2/boot2.c index 2f02c82..3db33c4 100644 --- a/sys/boot/mips/beri/boot2/boot2.c +++ b/sys/boot/mips/beri/boot2/boot2.c @@ -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; diff --git a/sys/boot/uboot/common/metadata.c b/sys/boot/uboot/common/metadata.c index c00b560..38db4bc 100644 --- a/sys/boot/uboot/common/metadata.c +++ b/sys/boot/uboot/common/metadata.c @@ -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); |