git: 67db7b43d07e - main - ppp: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])

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

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

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

    ppp: 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/ppp/chat.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/ppp/chat.h b/usr.sbin/ppp/chat.h
index 54e86834be60..c8fcf9a9c3cc 100644
--- a/usr.sbin/ppp/chat.h
+++ b/usr.sbin/ppp/chat.h
@@ -26,6 +26,8 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/param.h>
+
 #define CHAT_EXPECT 0
 #define CHAT_SEND   1
 #define CHAT_DONE   2
@@ -74,7 +76,7 @@ struct chat {
 
 #define descriptor2chat(d) \
   ((d)->type == CHAT_DESCRIPTOR ? (struct chat *)(d) : NULL)
-#define	VECSIZE(v)	(sizeof(v) / sizeof(v[0]))
+#define	VECSIZE(v)	nitems(v)
 
 extern void chat_Init(struct chat *, struct physical *);
 extern int chat_Setup(struct chat *, const char *, const char *);