git: d94c991f3bcd - main - setkey: 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:32 UTC
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)