git: abab59f662b3 - main - usbconfig: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])

From: Warner Losh <imp_at_FreeBSD.org>
Date: Mon, 29 Apr 2024 04:27:25 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=abab59f662b380f5ad46de03f9818f8c1f5ca0c4

commit abab59f662b380f5ad46de03f9818f8c1f5ca0c4
Author:     Elyes Haouas <ehaouas@noos.fr>
AuthorDate: 2023-11-07 17:14:17 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-04-29 03:30:55 +0000

    usbconfig: 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/usbconfig/usbconfig.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/usbconfig/usbconfig.c b/usr.sbin/usbconfig/usbconfig.c
index 7d257fea52cd..e28f8de9f75c 100644
--- a/usr.sbin/usbconfig/usbconfig.c
+++ b/usr.sbin/usbconfig/usbconfig.c
@@ -36,7 +36,7 @@
 #include <grp.h>
 #include <errno.h>
 #include <ctype.h>
-#include <sys/types.h>
+#include <sys/param.h>
 
 #include <libusb20_desc.h>
 #include <libusb20.h>
@@ -210,7 +210,7 @@ get_token(const char *str, uint8_t narg)
 {
 	uint8_t n;
 
-	for (n = 0; n != (sizeof(token) / sizeof(token[0])); n++) {
+	for (n = 0; n != nitems(token); n++) {
 		if (strcasecmp(str, token[n].name) == 0) {
 			if (token[n].narg > narg) {
 				/* too few arguments */