From 424bd7e38c97c6d859b0fa5e4c38ca37c6439628 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Fri, 2 Oct 2015 10:05:32 +0200 Subject: [PATCH] def.h: added LWIP_ARRAYSIZE() macro --- src/include/lwip/def.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/include/lwip/def.h b/src/include/lwip/def.h index 5d2c7b14..b96172fd 100644 --- a/src/include/lwip/def.h +++ b/src/include/lwip/def.h @@ -49,6 +49,9 @@ extern "C" { #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y)) #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y)) +/* Get the number of entries in an array ('x' must NOT be a pointer!) */ +#define LWIP_ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0])) + #ifndef NULL #define NULL ((void *)0) #endif