Skip to contentSkip to conversation

src: Fix indenting weirdness is pktbuff.c w/out changing indent

PATCH Applied Duncan Roe 2 participants 2 messages Jan 15, 2020 – Jan 16, 2020 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

PATCH 1/1 src: Fix indenting weirdness is pktbuff.c w/out changing indent

In pktb_alloc, declare struct ethhdr *ethhdr at function start, thus avoiding cute braces on case AF_BRIDGE.
This costs nothing and generates less code.

---
 src/extra/pktbuff.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
src/extra/pktbuff.c +3 -4
index 37f6bc0..b7d379e 100644
@@ -53,6 +53,7 @@ struct pkt_buff *pktb_alloc(int family, void *data, size_t len, size_t extra)
 {
 	struct pkt_buff *pktb;
 	void *pkt_data;
+	struct ethhdr *ethhdr;
 
 	pktb = calloc(1, sizeof(struct pkt_buff) + len + extra);
 	if (pktb == NULL)
@@ -74,9 +75,8 @@ struct pkt_buff *pktb_alloc(int family, void *data, size_t len, size_t extra)
 	case AF_INET6:
 		pktb->network_header = pktb->data;
 		break;
-	case AF_BRIDGE: {
-		struct ethhdr *ethhdr = (struct ethhdr *)pktb->data;
-
+	case AF_BRIDGE:
+		ethhdr = (struct ethhdr *)pktb->data;
 		pktb->mac_header = pktb->data;
 
 		switch(ethhdr->h_proto) {
@@ -92,7 +92,6 @@ struct pkt_buff *pktb_alloc(int family, void *data, size_t len, size_t extra)
 		}
 		break;
 	}
-	}
 	return pktb;
 }
 
Signature · 1 line
2.14.5
maintainer Applied
#1 lore raw
Quoted 3 lines · Duncan Roe

In pktb_alloc, declare struct ethhdr *ethhdr at function start, thus avoiding cute braces on case AF_BRIDGE.
This costs nothing and generates less code.

Applied, thanks.