Re: [PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-12 Thread Karthik Nayak
On Mon, Dec 12, 2016 at 10:10 PM, Jeff King wrote: > On Mon, Dec 12, 2016 at 09:59:49PM +0530, Karthik Nayak wrote: > >> >> > This caller never stores the return value, and it ends up leaking. So I >> >> > wonder if you wanted "static struct strbuf" in the first place (and that >>

Re: [PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-12 Thread Jeff King
On Mon, Dec 12, 2016 at 09:59:49PM +0530, Karthik Nayak wrote: > >> > This caller never stores the return value, and it ends up leaking. So I > >> > wonder if you wanted "static struct strbuf" in the first place (and that > >> > would explain the strbuf_reset() in your function). > >> > >> Ah!

Re: [PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-12 Thread Karthik Nayak
On Mon, Dec 12, 2016 at 5:45 PM, Jeff King wrote: > On Mon, Dec 12, 2016 at 04:50:20PM +0530, Karthik Nayak wrote: > >> > This caller never stores the return value, and it ends up leaking. So I >> > wonder if you wanted "static struct strbuf" in the first place (and that >> > would

Re: [PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-12 Thread Jeff King
On Mon, Dec 12, 2016 at 04:50:20PM +0530, Karthik Nayak wrote: > > This caller never stores the return value, and it ends up leaking. So I > > wonder if you wanted "static struct strbuf" in the first place (and that > > would explain the strbuf_reset() in your function). > > Ah! Yes this should

Re: [PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-12 Thread Karthik Nayak
On Fri, Dec 9, 2016 at 7:33 PM, Jeff King wrote: > On Wed, Dec 07, 2016 at 09:06:26PM +0530, Karthik Nayak wrote: > >> +const char *quote_literal_for_format(const char *s) >> { >> + struct strbuf buf = STRBUF_INIT; >> >> + strbuf_reset(); >> + while (*s) { >> +

Re: [PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-09 Thread Jeff King
On Wed, Dec 07, 2016 at 09:06:26PM +0530, Karthik Nayak wrote: > +const char *quote_literal_for_format(const char *s) > { > + struct strbuf buf = STRBUF_INIT; > > + strbuf_reset(); > + while (*s) { > + const char *ep = strchrnul(s, '%'); > + if (s < ep) > +

[PATCH v8 18/19] branch: use ref-filter printing APIs

2016-12-07 Thread Karthik Nayak
From: Karthik Nayak Port branch.c to use ref-filter APIs for printing. This clears out most of the code used in branch.c for printing and replaces them with calls made to the ref-filter library. Introduce build_format() which gets the format required for printing of refs.