From d94c991f3bcd31b7d001725152fc3a7685afe15b Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Tue, 7 Nov 2023 18:38:15 +0100 Subject: [PATCH] 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 --- 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)