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

commit d94c991f3bcd31b7d001725152fc3a7685afe15b
Author:     Elyes Haouas <ehaouas@noos.fr>
AuthorDate: 2023-11-07 17:38:15 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-29 04:21:09 +0000

    setkey: 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>
---
 sbin/setkey/setkey.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/setkey/setkey.c b/sbin/setkey/setkey.c
index d9b905ad845e..f7268d8f1e10 100644
--- a/sbin/setkey/setkey.c
+++ b/sbin/setkey/setkey.c
@@ -502,7 +502,7 @@ static const char *ipproto[] = {
 };
 
 #define STR_OR_ID(x, tab) \
-	(((x) < sizeof(tab)/sizeof(tab[0]) && tab[(x)])	? tab[(x)] : numstr(x))
+	(((x) < nitems(tab) && tab[(x)]) ? tab[(x)] : numstr(x))
 
 const char *
 numstr(int x)



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