Simplify assert macros

This commit is contained in:
ruti 2024-12-27 16:48:31 +03:00
parent 58f9ad5b07
commit 6027841374
2 changed files with 6 additions and 5 deletions

5
main.c
View File

@ -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";

View File

@ -4,6 +4,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include <assert.h>
#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