[iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-21 Thread Phil Sutter
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 --- ip/tc

RE: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-21 Thread David Laight
From: Of Phil Sutter > Sent: 21 June 2016 17:19 > 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 b

Re: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-21 Thread Phil Sutter
On Tue, Jun 21, 2016 at 09:53:43AM -0700, Stephen Hemminger wrote: > On Tue, 21 Jun 2016 18:18:41 +0200 > Phil Sutter 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,

Re: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-21 Thread Stephen Hemminger
On Tue, 21 Jun 2016 18:18:41 +0200 Phil Sutter 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

Re: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-22 Thread Jakub Sitnicki
On Tue, Jun 21, 2016 at 06:18 PM CEST, Phil Sutter 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 neithe

Re: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-22 Thread Phil Sutter
On Wed, Jun 22, 2016 at 01:34:13PM +0200, Jakub Sitnicki wrote: > On Tue, Jun 21, 2016 at 06:18 PM CEST, Phil Sutter wrote: [...] > > - a = attrs[TCP_METRICS_ATTR_ADDR_IPV4]; > > - if (a) { > > + if ((a = attrs[TCP_METRICS_ATTR_ADDR_IPV4])) { > > Copy the pointer inside the branch? > > Sam

RE: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-22 Thread David Laight
From: Jakub Sitnicki > Sent: 22 June 2016 12:34 ... > > - a = attrs[TCP_METRICS_ATTR_ADDR_IPV4]; > > - if (a) { > > + if ((a = attrs[TCP_METRICS_ATTR_ADDR_IPV4])) { > > Copy the pointer inside the branch? > > Same gain on indentation while keeping checkpatch happy. Or as below (hacked from

Re: [iproute PATCH v2 7/7] ip/tcp_metrics: Simplify process_msg a bit

2016-06-22 Thread Phil Sutter
Hi David, On Wed, Jun 22, 2016 at 01:00:08PM +, David Laight wrote: > From: Jakub Sitnicki > > Sent: 22 June 2016 12:34 > ... > > > - a = attrs[TCP_METRICS_ATTR_ADDR_IPV4]; > > > - if (a) { > > > + if ((a = attrs[TCP_METRICS_ATTR_ADDR_IPV4])) { > > > > Copy the pointer inside the branch? > >