From 23cae3851333996a3a166fa643cf1385fc1ad536 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 4 Nov 2010 00:57:49 +0100 Subject: [PATCH] xt_mp2t: reduce redundant union/struct encapsulation The unnamed union does not serve any purpose (there is just one union member anyway), and the struct is also not referred to (e.g. address taken), so just flatten the outer struct entirely. --- extensions/xt_mp2t.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/extensions/xt_mp2t.c b/extensions/xt_mp2t.c index 1a7aa15..cffb399 100644 --- a/extensions/xt_mp2t.c +++ b/extensions/xt_mp2t.c @@ -251,12 +251,8 @@ struct pid_data_t { /* Data to match a stream / connection */ struct mp2t_stream_match { /* Like xt_hashlimit: dsthash_dst */ - union { - struct { - __be32 dst; /* MC addr first */ - __be32 src; - } ip; - }; + __be32 dst_addr; /* MC addr first */ + __be32 src_addr; __be16 dst_port; __be16 src_port; }; @@ -966,8 +962,8 @@ dissect_mp2t(unsigned char *payload_ptr, u16 payload_len, /* Fill in the match struct */ memset(&match, 0, sizeof(match)); /* Worried about struct padding */ - match.ip.src = iph->saddr; - match.ip.dst = iph->daddr; + match.src_addr = iph->saddr; + match.dst_addr = iph->daddr; match.src_port = uh->source; match.dst_port = uh->dest; @@ -1243,8 +1239,8 @@ static int mp2t_seq_show_real(struct mp2t_stream *stream, struct seq_file *s, res = seq_printf(s, "bucket:%d dst:%pI4 src:%pI4 dport:%u sport:%u " "pids:%d skips:%llu discontinuity:%llu\n", bucket, - &stream->match.ip.dst, - &stream->match.ip.src, + &stream->match.dst_addr, + &stream->match.src_addr, ntohs(stream->match.dst_port), ntohs(stream->match.src_port), stream->pid_list_len,