Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Apr 2024 04:27:16 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: 2f8ea2f605ac - main - ctladm: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Message-ID:  <202404290427.43T4RGWj044625@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=2f8ea2f605acbeadb3c2fe9d336fcf558f2d4fa6

commit 2f8ea2f605acbeadb3c2fe9d336fcf558f2d4fa6
Author:     Elyes Haouas <ehaouas@noos.fr>
AuthorDate: 2023-11-07 17:11:10 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-29 03:24:47 +0000

    ctladm: 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/ctladm/ctladm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 9d2f14de28ed..81b8d3196357 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -2809,7 +2809,7 @@ cctl_islist_start_element(void *user_data, const char *name, const char **attr)
 	if ((u_int)islist->level >= (sizeof(islist->cur_sb) /
 	    sizeof(islist->cur_sb[0])))
 		errx(1, "%s: too many nesting levels, %zd max", __func__,
-		     sizeof(islist->cur_sb) / sizeof(islist->cur_sb[0]));
+		     nitems(islist->cur_sb));
 
 	islist->cur_sb[islist->level] = sbuf_new_auto();
 	if (islist->cur_sb[islist->level] == NULL)
@@ -3240,7 +3240,7 @@ cctl_start_element(void *user_data, const char *name, const char **attr)
 	if ((u_int)devlist->level >= (sizeof(devlist->cur_sb) /
 	    sizeof(devlist->cur_sb[0])))
 		errx(1, "%s: too many nesting levels, %zd max", __func__,
-		     sizeof(devlist->cur_sb) / sizeof(devlist->cur_sb[0]));
+		     nitems(devlist->cur_sb));
 
 	devlist->cur_sb[devlist->level] = sbuf_new_auto();
 	if (devlist->cur_sb[devlist->level] == NULL)
@@ -3504,7 +3504,7 @@ cctl_start_pelement(void *user_data, const char *name, const char **attr)
 	if ((u_int)portlist->level >= (sizeof(portlist->cur_sb) /
 	    sizeof(portlist->cur_sb[0])))
 		errx(1, "%s: too many nesting levels, %zd max", __func__,
-		     sizeof(portlist->cur_sb) / sizeof(portlist->cur_sb[0]));
+		     nitems(portlist->cur_sb));
 
 	portlist->cur_sb[portlist->level] = sbuf_new_auto();
 	if (portlist->cur_sb[portlist->level] == NULL)



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