From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH iproute2-next 6/6] ipaddress: Get rid of print_linkinfo_brief() Date: Tue, 30 Jan 2018 09:24:12 -0800 Message-ID: <20180130092412.42d9f6fc@xeon-e3> References: <1517331168-4132-1-git-send-email-serhe.popovych@gmail.com> <1517331168-4132-7-git-send-email-serhe.popovych@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Serhey Popovych Return-path: Received: from mail-pg0-f68.google.com ([74.125.83.68]:45396 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbeA3RYV (ORCPT ); Tue, 30 Jan 2018 12:24:21 -0500 Received: by mail-pg0-f68.google.com with SMTP id m136so7759141pga.12 for ; Tue, 30 Jan 2018 09:24:20 -0800 (PST) In-Reply-To: <1517331168-4132-7-git-send-email-serhe.popovych@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 30 Jan 2018 18:52:48 +0200 Serhey Popovych 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.