git: 8f65dcd6276b - main - ctld: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Apr 2024 04:27:17 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=8f65dcd6276bf139a2fe87c1bbeffcc1fed015e4
commit 8f65dcd6276bf139a2fe87c1bbeffcc1fed015e4
Author: Elyes Haouas <ehaouas@noos.fr>
AuthorDate: 2023-11-07 17:11:34 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-29 03:24:47 +0000
ctld: 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/ctld/kernel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c
index cdc0b0fa187d..dd1c89d0e9b8 100644
--- a/usr.sbin/ctld/kernel.c
+++ b/usr.sbin/ctld/kernel.c
@@ -168,7 +168,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])))
log_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)
@@ -290,7 +290,7 @@ cctl_start_pelement(void *user_data, const char *name, const char **attr)
if ((u_int)devlist->level >= (sizeof(devlist->cur_sb) /
sizeof(devlist->cur_sb[0])))
log_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)