Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Serhey Popovych <serhe.popovych@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next 6/6] ipaddress: Get rid of print_linkinfo_brief()
Date: Tue, 30 Jan 2018 09:24:12 -0800	[thread overview]
Message-ID: <20180130092412.42d9f6fc@xeon-e3> (raw)
In-Reply-To: <1517331168-4132-7-git-send-email-serhe.popovych@gmail.com>

On Tue, 30 Jan 2018 18:52:48 +0200
Serhey Popovych <serhe.popovych@gmail.com> wrote:

> +	if (brief) {
> +		print_name_and_link("%-16s ", COLOR_NONE, name, tb);
> +
> +		if (tb[IFLA_OPERSTATE])
> +			print_operstate(fp, rta_getattr_u8(tb[IFLA_OPERSTATE]));
> +
> +		if (filter.family == AF_PACKET) {
> +			if (tb[IFLA_ADDRESS]) {
> +				struct rtattr *rta = tb[IFLA_ADDRESS];
> +
> +				print_color_string(PRINT_ANY,
> +						   COLOR_MAC,
> +						   "address",
> +						   "%s ",
> +						   ll_addr_n2a(RTA_DATA(rta),
> +							       RTA_PAYLOAD(rta),
> +							       ifi->ifi_type,
> +							       b1, sizeof(b1)));
> +			}
> +
> +			print_link_flags(fp, ifi->ifi_flags, m_flag);
> +			print_string(PRINT_FP, NULL, "%s", "\n");
> +		}
> +
> +		fflush(fp);
> +		return 0;
> +	}

To keep function shorter and therefore more readable, why not:

	if (brief)
		return print_linkinfo_brief(fp, ifi, tb);

And put this if branch in new version of print_linkinfo_brief.

  reply	other threads:[~2018-01-30 17:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30 16:52 [PATCH iproute2-next 0/6] ipaddress: Get rid of print_linkinfo_brief() Serhey Popovych
2018-01-30 16:52 ` [PATCH iproute2-next 1/6] ipaddress: Improve print_linkinfo() Serhey Popovych
2018-01-30 16:52 ` [PATCH iproute2-next 2/6] ipaddress: Simplify print_linkinfo_brief() and it's usage Serhey Popovych
2018-01-30 16:52 ` [PATCH iproute2-next 3/6] lib: Correct object file dependencies Serhey Popovych
2018-01-30 16:52 ` [PATCH iproute2-next 4/6] utils: Introduce and use get_ifname_rta() Serhey Popovych
2018-01-30 16:52 ` [PATCH iproute2-next 5/6] utils: Introduce and use print_name_and_link() to print name@link Serhey Popovych
2018-01-30 16:52 ` [PATCH iproute2-next 6/6] ipaddress: Get rid of print_linkinfo_brief() Serhey Popovych
2018-01-30 17:24   ` Stephen Hemminger [this message]
2018-01-30 18:10     ` Serhey Popovych

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=20180130092412.42d9f6fc@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.org \
    --cc=serhe.popovych@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox