( ... I don't like complex macros for simple things)
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/packet.h | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/src/packet.h b/src/packet.h
index 21d4c37..4979a5d 100644
--- a/src/packet.h
+++ b/src/packet.h
@@ -55,19 +55,17 @@ static inline void PACKET_INIT_STRUCT(struct pkt_hdr *p)
struct pkt_hdr packet; \
PACKET_INIT_STRUCT(&packet)
-#define pkt_iph_len(pkt) __extension__ ({ \
- __u8 len__ = 0; \
- switch ((pkt)->pkt_protocol) { \
- case ETH_P_IP: \
- len__ = (pkt)->iphdr->ihl * 4; \
- break; \
- case ETH_P_IPV6: \
- len__ = 40; \
- break; \
- }; \
- len__; \
- })
-
+static inline __u8 pkt_iph_len(const struct pkt_hdr *pkt)
+{
+ switch (pkt->pkt_protocol) {
+ case ETH_P_IP:
+ return pkt->iphdr->ihl * 4;
+ case ETH_P_IPV6:
+ return 40;
+ default:
+ return 0;
+ }
+}
static inline __u8 pkt_ip_protocol(const struct pkt_hdr *p)
{
--
1.7.8.4