netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH iproute2] bridge/mdb: fix missing new line when show bridge mdb
Date: Fri, 7 Sep 2018 08:14:30 +0800	[thread overview]
Message-ID: <20180906134037.GA1418@leo.usersys.redhat.com> (raw)
In-Reply-To: <20180906140053.0778cee3@shemminger-XPS-13-9360>

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

  reply	other threads:[~2018-09-07  4:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05  3:33 [PATCH iproute2] bridge/mdb: fix missing new line when show bridge mdb Hangbin Liu
2018-09-06 13:00 ` Stephen Hemminger
2018-09-07  0:14   ` Hangbin Liu [this message]
2018-09-11  1:26 ` [PATCHv2 " Hangbin Liu
2018-09-11 11:01   ` Phil Sutter
2018-09-11 15:30   ` Stephen Hemminger
2018-09-11 14:04 ` [PATCHv3 " Hangbin Liu
2018-09-11 15:31   ` Stephen Hemminger
2018-09-12  1:39 ` [PATCHv4 " Hangbin Liu

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=20180906134037.GA1418@leo.usersys.redhat.com \
    --to=liuhangbin@gmail.com \
    --cc=dsahern@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;
as well as URLs for NNTP newsgroup(s).