]> git.corax.cc Git - corax/commitdiff
Add sizeof_a() convenience macro for determining the number of elements in a static...
authorMatthias Kruk <m@m10k.eu>
Fri, 13 Mar 2020 16:48:42 +0000 (01:48 +0900)
committerMatthias Kruk <m@m10k.eu>
Fri, 13 Mar 2020 16:48:42 +0000 (01:48 +0900)
include/corax/types.h

index 119dfe1eaa185a10b178d13984236bf8c80183ce..eb09fbf9aa0c3007fdbb2f9daae3872542090367 100644 (file)
@@ -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 */