[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7108fddb-b698-8d8f-9746-5540c6aca546@gmail.com>
Date: Tue, 30 Jan 2018 20:10:29 +0200
From: Serhey Popovych <serhe.popovych@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-next 6/6] ipaddress: Get rid of
print_linkinfo_brief()
Stephen Hemminger wrote:
> 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.
>
Agree, will make it static and branch as suggested. Thanks.
Addressed in v2.
Download attachment "signature.asc" of type "application/pgp-signature" (491 bytes)
Powered by blists - more mailing lists