Re: [PATCH v8 18/19] branch: use ref-filter printing APIs
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Dec 12, 2016, 16:29 UTC
- Message-ID
- <CAOLa=ZT1KN_iw7JzB78hPb-LrY_yaDZk0D+TqY2W9hCOftzumA@mail.gmail.com>
- In-Reply-To
- <20161212121548.aj2ptnmrqt67anlc@sigill.intra.peff.net>
On Mon, Dec 12, 2016 at 5:45 PM, Jeff King <peff@peff.net> wrote:
Show 14 quoted lines
> 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 be 'static struct strbuf' indeed, I blindly copied Junio's >> suggestion. >> >> strbuf_detach() is also a better way to go. > > One of the other, though. If it's static, then you _don't_ want to > detach. >
Wait. Why not? since it gets added to the strbuf's within build_format() and that value is not needed again, why do we need to re-allocate? we can use the same variable again (i.e by keeping it as static).
I'm sorry, but I didn't get why these two should be mutually exclusive?
-- Regards, Karthik Nayak