Use nitems() from sys/param.h.
Reviewed by: ngie MFC after: 2 weeks. Differential Revision: https://reviews.freebsd.org/D9942
This commit is contained in:
parent
049e195404
commit
63128851f3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=317743
@ -99,14 +99,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)
|
||||
@ -137,7 +137,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;
|
||||
@ -153,7 +153,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)
|
||||
@ -179,14 +179,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)
|
||||
@ -227,7 +227,7 @@ choose_part_type(const char *def_scheme)
|
||||
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)
|
||||
@ -662,7 +662,7 @@ gpart_edit(struct gprovider *pp)
|
||||
"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);
|
||||
}
|
||||
@ -1200,7 +1200,7 @@ gpart_create(struct gprovider *pp, char *default_type, char *default_size,
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user