All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: brian.haley@hp.com, xiaosuo@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net: use the macros defined for the members of flowi
Date: Mon, 15 Nov 2010 17:56:48 -0800 (PST)	[thread overview]
Message-ID: <20101115.175648.226754712.davem@davemloft.net> (raw)
In-Reply-To: <1289857126.3364.14.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.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.


  parent reply	other threads:[~2010-11-16  1:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13  4:43 [PATCH] net: use the macros defined for the members of flowi Changli Gao
2010-11-15 21:33 ` Brian Haley
2010-11-15 21:38   ` Eric Dumazet
2010-11-15 21:57     ` Eric Dumazet
2010-11-16  1:56     ` David Miller [this message]
2010-11-17 20:29 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101115.175648.226754712.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=brian.haley@hp.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiaosuo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.