summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authoraraujo <araujo@FreeBSD.org>2017-05-17 05:47:31 +0000
committeraraujo <araujo@FreeBSD.org>2017-05-17 05:47:31 +0000
commit7b8496db357e6b89ee6083a3e16841eada7d2c26 (patch)
treef2ed7ad783a6947acd634fd0db430fda5f145013 /usr.sbin
parent847ad7b631e1bb90fa11051182061bdce396c755 (diff)
downloadFreeBSD-src-7b8496db357e6b89ee6083a3e16841eada7d2c26.zip
FreeBSD-src-7b8496db357e6b89ee6083a3e16841eada7d2c26.tar.gz
MFC r317743:
Use nitems() from sys/param.h. Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D9942
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/bsdinstall/partedit/gpart_ops.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c
index 89d7529..dc1c95c 100644
--- a/usr.sbin/bsdinstall/partedit/gpart_ops.c
+++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c
@@ -101,14 +101,14 @@ newfs_command(const char *fstype, char *command, int use_default)
if (!use_default) {
int choice;
choice = dlg_checklist("UFS Options", "", 0, 0, 0,
- sizeof(items)/sizeof(items[0]), items, NULL,
+ nitems(items), items, NULL,
FLAG_CHECK, &i);
if (choice == 1) /* Cancel */
return;
}
strcpy(command, "newfs ");
- for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) {
+ for (i = 0; i < (int)nitems(items); i++) {
if (items[i].state == 0)
continue;
if (strcmp(items[i].name, "UFS1") == 0)
@@ -139,7 +139,7 @@ newfs_command(const char *fstype, char *command, int use_default)
if (!use_default) {
int choice;
choice = dlg_checklist("ZFS Options", "", 0, 0, 0,
- sizeof(items)/sizeof(items[0]), items, NULL,
+ nitems(items), items, NULL,
FLAG_CHECK, &i);
if (choice == 1) /* Cancel */
return;
@@ -155,7 +155,7 @@ newfs_command(const char *fstype, char *command, int use_default)
sprintf(command, "%s -o cachefile=%s/zpool.cache ",
command, zfsboot_path);
}
- for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) {
+ for (i = 0; i < (int)nitems(items); i++) {
if (items[i].state == 0)
continue;
if (strcmp(items[i].name, "fletcher4") == 0)
@@ -181,14 +181,14 @@ newfs_command(const char *fstype, char *command, int use_default)
if (!use_default) {
int choice;
choice = dlg_checklist("FAT Options", "", 0, 0, 0,
- sizeof(items)/sizeof(items[0]), items, NULL,
+ nitems(items), items, NULL,
FLAG_RADIO, &i);
if (choice == 1) /* Cancel */
return;
}
strcpy(command, "newfs_msdos ");
- for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) {
+ for (i = 0; i < (int)nitems(items); i++) {
if (items[i].state == 0)
continue;
if (strcmp(items[i].name, "FAT32") == 0)
@@ -231,7 +231,7 @@ parttypemenu:
dialog_vars.default_item = __DECONST(char *, def_scheme);
cancel = dlg_menu("Partition Scheme",
"Select a partition scheme for this volume:", 0, 0, 0,
- sizeof(items) / sizeof(items[0]), items, &choice, NULL);
+ nitems(items), items, &choice, NULL);
dialog_vars.default_item = NULL;
if (cancel)
@@ -653,7 +653,7 @@ endedit:
"freebsd") == 0)
gpart_partition(pp->lg_name, "BSD");
- for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++)
+ for (i = 0; i < nitems(items); i++)
if (items[i].text_free)
free(items[i].text);
}
@@ -1191,7 +1191,7 @@ addpartform:
set_default_part_metadata(newpartname, scheme,
items[0].text, items[2].text, newfs);
- for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++)
+ for (i = 0; i < nitems(items); i++)
if (items[i].text_free)
free(items[i].text);
OpenPOWER on IntegriCloud