From owner-svn-src-all@freebsd.org Wed May 3 14:03:47 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA44CD5C89D; Wed, 3 May 2017 14:03:47 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC30B1534; Wed, 3 May 2017 14:03:47 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v43E3kbO088449; Wed, 3 May 2017 14:03:46 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v43E3ksq088448; Wed, 3 May 2017 14:03:46 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201705031403.v43E3ksq088448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 3 May 2017 14:03:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317743 - head/usr.sbin/bsdinstall/partedit X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2017 14:03:48 -0000 Author: araujo Date: Wed May 3 14:03:46 2017 New Revision: 317743 URL: https://svnweb.freebsd.org/changeset/base/317743 Log: Use nitems() from sys/param.h. Reviewed by: ngie MFC after: 2 weeks. Differential Revision: https://reviews.freebsd.org/D9942 Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c ============================================================================== --- head/usr.sbin/bsdinstall/partedit/gpart_ops.c Wed May 3 13:57:31 2017 (r317742) +++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c Wed May 3 14:03:46 2017 (r317743) @@ -99,14 +99,14 @@ newfs_command(const char *fstype, char * 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 * 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 * 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 * 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 @@ 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) @@ -662,7 +662,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); } @@ -1200,7 +1200,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);