From 9d7b581310eb500910a4cf89e9f2a317eee40ec8 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 14 Oct 2022 16:21:42 -0400 Subject: Add `COUNTOF` macro to tools/common.h --- tools/common.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/common.h') diff --git a/tools/common.h b/tools/common.h index f04e917b..2c690423 100644 --- a/tools/common.h +++ b/tools/common.h @@ -19,6 +19,8 @@ #error Define USAGE_OPTS before including common.h! #endif +#define COUNTOF(...) (sizeof(__VA_ARGS__) / sizeof(*(__VA_ARGS__))) + #define error_exit(...) exit((fprintf(stderr, PROGRAM_NAME ": " __VA_ARGS__), 1)) noreturn void usage_exit(int status) { -- cgit v1.3.1-sl0p