[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20101115.175648.226754712.davem@davemloft.net>
Date: Mon, 15 Nov 2010 17:56:48 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: brian.haley@...com, xiaosuo@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH] net: use the macros defined for the members of flowi
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Mon, 15 Nov 2010 22:38:46 +0100
> Le lundi 15 novembre 2010 à 16:33 -0500, Brian Haley a écrit :
>> On 11/12/2010 11:43 PM, Changli Gao wrote:
>> > Use the macros defined for the members of flowi to clean the code up.
>> >
>> > diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
>> > index 865fd76..36cd0b7 100644
>> > --- a/net/bridge/br_netfilter.c
>> > +++ b/net/bridge/br_netfilter.c
>> > @@ -412,13 +412,8 @@ static int br_nf_pre_routing_finish(struct sk_buff *skb)
>> > if (dnat_took_place(skb)) {
>> > if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) {
>> > struct flowi fl = {
>> > - .nl_u = {
>> > - .ip4_u = {
>> > - .daddr = iph->daddr,
>> > - .saddr = 0,
>> > - .tos = RT_TOS(iph->tos) },
>> > - },
>> > - .proto = 0,
>> > + .fl4_dst = iph->daddr,
>> > + .fl4_tos = RT_TOS(iph->tos),
>> > };
>>
>> Are these actually equivalent? You dropped two assignments to zero.
>> I always thought things on the stack weren't.
>
> Same question on lkml few hours ago. I think gcc does the assignement to
> zero, even on automatic variables (at least done on x86), but could not
> find a doc on it.
It always has, it always will. "type var = { };" always zeros
out the structure.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists