From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hangbin Liu Subject: Re: [PATCH iproute2] bridge/mdb: fix missing new line when show bridge mdb Date: Fri, 7 Sep 2018 08:14:30 +0800 Message-ID: <20180906134037.GA1418@leo.usersys.redhat.com> References: <1536118423-20604-1-git-send-email-liuhangbin@gmail.com> <20180906140053.0778cee3@shemminger-XPS-13-9360> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, David Ahern To: Stephen Hemminger Return-path: Received: from mail-pl1-f193.google.com ([209.85.214.193]:36075 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726114AbeIGEwm (ORCPT ); Fri, 7 Sep 2018 00:52:42 -0400 Received: by mail-pl1-f193.google.com with SMTP id e11-v6so5727564plb.3 for ; Thu, 06 Sep 2018 17:14:42 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180906140053.0778cee3@shemminger-XPS-13-9360> Sender: netdev-owner@vger.kernel.org List-ID: Hi Stephen, On Thu, Sep 06, 2018 at 02:00:53PM +0100, Stephen Hemminger wrote: > > @@ -164,6 +168,10 @@ static void print_mdb_entry(FILE *f, int ifindex, const struct br_mdb_entry *e, > > print_string(PRINT_ANY, "timer", " %s", > > format_timer(timer)); > > } > > + > > + if (!is_json_context()) > > + fprintf(f, "\n"); > > + > > close_json_object(); > > } > > > > Thanks for catching this. > > Now that there is a json print library, the preferred pattern for > this is: > print_string(PRINT_FP, NULL, "\n", NULL); Are we going to replace all printf() by json print library, even not in json context? If yes, I can post a v2 patch. Becuase there are still a lot fprintf() in mdb.c. > > I plan to introduce a helper > print_fp(...) > > and it would be easier if all places were consistent. cool, that would be more clear. Thanks Hangbin