Re: [PATCH v5 2/7] pretty: Allow %(trailers) options with explicit value
- From
Jeff King <peff@peff.net>
- Date
- Jan 29, 2019, 16:57 UTC
- Message-ID
- <20190129165715.GB7349@sigill.intra.peff.net>
- In-Reply-To
- <87tvhsklpb.fsf@0x63.nu>
On Tue, Jan 29, 2019 at 07:45:06AM +0100, Anders Waldenborg wrote:
Show 5 quoted lines
> > Instead of using "char buf[8]", just using a strbuf and avoidng > > strlcpy() would make the code much better, I would think. > > Yes, taking the heap allocation hit would most likely make the intent > clearer.
If you can reuse the same struct and strbuf_reset() it each time, then that amortizes the cost of the heap (to basically once per program run, instead of once per commit).
-Peff