[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160621170714.GE19797@orbyte.nwl.cc>
Date: Tue, 21 Jun 2016 19:07:14 +0200
From: Phil Sutter <phil@....cc>
To: Stephen Hemminger <shemming@...cade.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
David Ahern <dsa@...ulusnetworks.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Julien Floret <julien.floret@...nd.com>, netdev@...r.kernel.org
Subject: Re: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit
On Tue, Jun 21, 2016 at 09:53:43AM -0700, Stephen Hemminger wrote:
> On Tue, 21 Jun 2016 18:18:41 +0200
> Phil Sutter <phil@....cc> wrote:
>
> > By combining the attribute extraction and check for existence, the
> > additional indentation level in the 'else' clause can be avoided.
> >
> > In addition to that, common actions for 'daddr' are combined since the
> > function returns if neither of the branches are taken.
> >
> > Signed-off-by: Phil Sutter <phil@....cc>
> > ---
> > ip/tcp_metrics.c | 45 ++++++++++++++++++---------------------------
> > 1 file changed, 18 insertions(+), 27 deletions(-)
> >
> > diff --git a/ip/tcp_metrics.c b/ip/tcp_metrics.c
> > index f82604f458ada..899830c127bcb 100644
> > --- a/ip/tcp_metrics.c
> > +++ b/ip/tcp_metrics.c
> > @@ -112,47 +112,38 @@ static int process_msg(const struct sockaddr_nl *who, struct nlmsghdr *n,
> > parse_rtattr(attrs, TCP_METRICS_ATTR_MAX, (void *) ghdr + GENL_HDRLEN,
> > len);
> >
> > - a = attrs[TCP_METRICS_ATTR_ADDR_IPV4];
> > - if (a) {
> > + if ((a = attrs[TCP_METRICS_ATTR_ADDR_IPV4])) {
>
> NAK, plus it fails checkpatch
Oh well, I'll drop it then and get rid of the remaining checkpatch
warnings before resending.
Thanks, Phil
Powered by blists - more mailing lists