From d1d652c060150985e1e580eb57b4b6829f6845c9 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Sun, 28 Apr 2024 20:55:30 -0600 Subject: rtadvctl: 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 --- usr.sbin/rtadvctl/rtadvctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/rtadvctl/rtadvctl.c b/usr.sbin/rtadvctl/rtadvctl.c index 727fa6ee1a52..9fdb643cef10 100644 --- a/usr.sbin/rtadvctl/rtadvctl.c +++ b/usr.sbin/rtadvctl/rtadvctl.c @@ -27,8 +27,8 @@ * */ +#include #include -#include #include #include #include @@ -137,7 +137,7 @@ usage(void) { int i; - for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) { + for (i = 0; (size_t)i < nitems(dtable); i++) { if (dtable[i].dt_comm == NULL) break; printf("%s\n", dtable[i].dt_comm); @@ -172,7 +172,7 @@ main(int argc, char *argv[]) if (argc == 0) usage(); - for (i = 0; (size_t)i < sizeof(dtable)/sizeof(dtable[0]); i++) { + for (i = 0; (size_t)i < nitems(dtable); i++) { if (dtable[i].dt_comm == NULL || strcmp(dtable[i].dt_comm, argv[0]) == 0) { action = dtable[i].dt_act; -- cgit v1.2.3