[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180130092412.42d9f6fc@xeon-e3>
Date:   Tue, 30 Jan 2018 09:24:12 -0800
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     Serhey Popovych <serhe.popovych@...il.com>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next 6/6] ipaddress: Get rid of
 print_linkinfo_brief()
On Tue, 30 Jan 2018 18:52:48 +0200
Serhey Popovych <serhe.popovych@...il.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.
Powered by blists - more mailing lists
 
