[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180906134037.GA1418@leo.usersys.redhat.com>
Date: Fri, 7 Sep 2018 08:14:30 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Stephen Hemminger <stephen@...workplumber.org>
Cc: netdev@...r.kernel.org, David Ahern <dsahern@...il.com>
Subject: Re: [PATCH iproute2] bridge/mdb: fix missing new line when show
bridge mdb
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
Powered by blists - more mailing lists