e1_input: Fix compiler warning by using offsetof
Use the offsetof/__builtin_offsetof to determine the
offset of a variable inside a structure instead of going
via a NULL pointer and taking the address.
This fixes:
warning: variably modified ‘dummyhalen_offset’ at file scope
diff --git a/openbsc/src/e1_input.c b/openbsc/src/e1_input.c
index b1dfe9b..9b205b7 100644
--- a/openbsc/src/e1_input.c
+++ b/openbsc/src/e1_input.c
@@ -110,11 +110,11 @@
u_int8_t control_foo; /* fake UM's ... */
} __attribute__((packed));
-static_assert((int)&((struct fake_linux_lapd_header*)NULL)->hatype == 2, hatype_offset);
-static_assert((int)&((struct fake_linux_lapd_header*)NULL)->halen == 4, halen_offset);
-static_assert((int)&((struct fake_linux_lapd_header*)NULL)->addr == 6, addr_offset);
-static_assert((int)&((struct fake_linux_lapd_header*)NULL)->protocol == 14, proto_offset);
-static_assert(sizeof(struct fake_linux_lapd_header) == 16, lapd_header_size);
+static_assert(offsetof(struct fake_linux_lapd_header, hatype) == 2, hatype_offset);
+static_assert(offsetof(struct fake_linux_lapd_header, halen) == 4, halen_offset);
+static_assert(offsetof(struct fake_linux_lapd_header, addr) == 6, addr_offset);
+static_assert(offsetof(struct fake_linux_lapd_header, protocol) == 14, proto_offset);
+static_assert(sizeof(struct fake_linux_lapd_header) == 16, lapd_header_size);
static int pcap_fd = -1;