From: Serhey Popovych <serhe.popovych@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next 6/6] ipaddress: Get rid of print_linkinfo_brief()
Date: Tue, 30 Jan 2018 20:10:29 +0200 [thread overview]
Message-ID: <7108fddb-b698-8d8f-9746-5540c6aca546@gmail.com> (raw)
In-Reply-To: <20180130092412.42d9f6fc@xeon-e3>
[-- Attachment #1.1: Type: text/plain, Size: 1168 bytes --]
Stephen Hemminger wrote:
> 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.
>
Agree, will make it static and branch as suggested. Thanks.
Addressed in v2.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
prev parent reply other threads:[~2018-01-30 18:10 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
2018-01-30 18:10 ` Serhey Popovych [this message]
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=7108fddb-b698-8d8f-9746-5540c6aca546@gmail.com \
--to=serhe.popovych@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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