aboutsummaryrefslogtreecommitdiffstats
path: root/tools/common.h
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2022-10-14 16:21:42 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2022-10-14 16:21:42 -0400
commit9d7b581310eb500910a4cf89e9f2a317eee40ec8 (patch)
tree59967fce040a26f1d1c9be664b6fd58788a7ed0a /tools/common.h
parentUpdate tools/unnamed.py for rgbds 0.6.0 object files (diff)
downloadpokeyellow-9d7b581310eb500910a4cf89e9f2a317eee40ec8.tar.gz
pokeyellow-9d7b581310eb500910a4cf89e9f2a317eee40ec8.tar.xz
pokeyellow-9d7b581310eb500910a4cf89e9f2a317eee40ec8.zip
Add `COUNTOF` macro to tools/common.h
Diffstat (limited to 'tools/common.h')
-rw-r--r--tools/common.h2
1 files changed, 2 insertions, 0 deletions
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) {