From d9281ee44b14d45baa71ec79afc1d80104e00ad1 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sat, 14 Mar 2020 01:48:42 +0900 Subject: [PATCH] Add sizeof_a() convenience macro for determining the number of elements in a static array --- include/corax/types.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/corax/types.h b/include/corax/types.h index 119dfe1..eb09fbf 100644 --- a/include/corax/types.h +++ b/include/corax/types.h @@ -43,4 +43,6 @@ typedef long long off_t; #define UID_ROOT ((uid_t)0) #define GID_ROOT ((gid_t)0) +#define sizeof_a(_a) (sizeof(_a) / sizeof(_a[0])) + #endif /* __TYPES_H */ -- 2.47.3