Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2024 04:27:27 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b561d8f59c7d - main - zonectl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Message-ID:  <202404290427.43T4RRph045095@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=b561d8f59c7de56f5da576530961aaeea2d89875

commit b561d8f59c7de56f5da576530961aaeea2d89875
Author:     Elyes Haouas <ehaouas@noos.fr>
AuthorDate: 2023-11-07 17:14:45 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-29 03:30:55 +0000

    zonectl: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
    
    Pull Request: https://github.com/freebsd/freebsd-src/pull/888
    Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
---
 usr.sbin/zonectl/zonectl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/zonectl/zonectl.c b/usr.sbin/zonectl/zonectl.c
index 56cd3c436d10..53e5e6599597 100644
--- a/usr.sbin/zonectl/zonectl.c
+++ b/usr.sbin/zonectl/zonectl.c
@@ -32,8 +32,8 @@
 
 #include <sys/cdefs.h>
 #include <sys/ioctl.h>
+#include <sys/param.h>
 #include <sys/stdint.h>
-#include <sys/types.h>
 #include <sys/endian.h>
 #include <sys/sbuf.h>
 #include <sys/queue.h>
@@ -401,7 +401,7 @@ main(int argc, char **argv)
 			int entry_num;
 
 			status = scsi_get_nv(zone_cmd_map,
-			    (sizeof(zone_cmd_map) / sizeof(zone_cmd_map[0])),
+			    nitems(zone_cmd_map),
 			    optarg, &entry_num, SCSI_NV_FLAG_IG_CASE);
 			if (status == SCSI_NV_FOUND)
 				action = zone_cmd_map[entry_num].value;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404290427.43T4RRph045095>