From 6027841374a530750dd07322b6964936c1a9196f Mon Sep 17 00:00:00 2001 From: ruti <> Date: Fri, 27 Dec 2024 16:48:31 +0300 Subject: [PATCH] Simplify assert macros --- main.c | 5 +++-- params.h | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index e542f4f..f95732c 100644 --- a/main.c +++ b/main.c @@ -27,8 +27,9 @@ #define VERSION "15" -ASSERT_SIZE(struct in_addr, 4) -ASSERT_SIZE(struct in6_addr, 16) +ASSERT(sizeof(struct in_addr) == 4) +ASSERT(sizeof(struct in6_addr) == 16) + char ip_option[1] = "\0"; diff --git a/params.h b/params.h index 5d3d7dd..706be71 100644 --- a/params.h +++ b/params.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "mpool.h" @@ -131,7 +132,6 @@ extern struct packet fake_udp; extern char ip_option[1]; -#define ASSERT_SIZE(stc, len) \ - static char t[-(int)sizeof(stc) + len]; \ - static char tt[(int)sizeof(t) * -1]; +#define ASSERT(exp) \ + char t[(exp) ? 1 : -1]; #endif