From: Jeff King Date: Tue, 29 Jan 2019 16:57:16 GMT Subject: Re: [PATCH v5 2/7] pretty: Allow %(trailers) options with explicit value 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: > > 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