Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH libnetfilter_queue] src: Fix indenting weirdness is pktbuff.c w/out changing indent
@ 2020-01-15  7:52 Duncan Roe
  2020-01-16 14:12 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Duncan Roe @ 2020-01-15  7:52 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

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.

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 src/extra/pktbuff.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/extra/pktbuff.c b/src/extra/pktbuff.c
index 37f6bc0..b7d379e 100644
--- a/src/extra/pktbuff.c
+++ b/src/extra/pktbuff.c
@@ -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;
 }
 
-- 
2.14.5


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH libnetfilter_queue] src: Fix indenting weirdness is pktbuff.c w/out changing indent
  2020-01-15  7:52 [PATCH libnetfilter_queue] src: Fix indenting weirdness is pktbuff.c w/out changing indent Duncan Roe
@ 2020-01-16 14:12 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2020-01-16 14:12 UTC (permalink / raw)
  To: Duncan Roe; +Cc: netfilter-devel

On Wed, Jan 15, 2020 at 06:52:03PM +1100, Duncan Roe wrote:
> 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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15  7:52 [PATCH libnetfilter_queue] src: Fix indenting weirdness is pktbuff.c w/out changing indent Duncan Roe
2020-01-16 14:12 ` Pablo Neira Ayuso

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git