From: Jeff King Date: Tue, 30 Jun 2015 17:50:11 GMT Subject: Re: [PATCH 3/3] introduce "format" date-mode Message-ID: <20150630175011.GA5349@peff.net> In-Reply-To: On Tue, Jun 30, 2015 at 09:22:18AM -0700, Junio C Hamano wrote: > Jeff King writes: > > >> strbuf_addf(&f, "%s ", fmt); > > > > Basically I was trying to avoid making any assumptions about exactly how > > strftime works. But presumably "stick a space in the format" is a > > universally reasonable thing to do. It's a hack, but it's contained to > > the function. > > Why can't I shake this feeling that (" %s", fmt), i.e. prepend not > append, is the safer thing to do than to append? Because then removing the extra space involves `memmove` of the buffer, rather than just shortening the length by one. -Peff