Re: [PATCH v6 6/7] git-reflog: add create and exists functions
- From
David Turner <dturner@twopensource.com>
- Date
- Jun 30, 2015, 21:19 UTC
- Message-ID
- <1435699146.30953.7.camel@twopensource.com>
- In-Reply-To
- <xmqq3819c6ze.fsf@gitster.dls.corp.google.com>
On Tue, 2015-06-30 at 12:48 -0700, Junio C Hamano wrote:
Show 19 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes: > > >>> Alternatives would be strbuf_reset() or declaring and releasing the > >>> strbuf within the for-loop scope. > >> > >> Because _reset() just rewinds the .len pointer without deallocating, > >> you would need an extra _release() before it goes out of scope. If > >> it is expected that the strbuf will be reused for a number of times, > >> the length of the string each iteration uses is similar, and you > >> will iterate the loop many times, "_reset() each time and _release() > >> to clean-up" pattern would save many calls to realloc/free. > > > > Yep, that's why I suggested strbuf_reset() as an alternative (and > > likely would have chosen it myself). > > OK, then let's do that by squashing this in. > > builtin/reflog.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-)
I squashed that into my repo on github:
https://github.com/dturner-tw/git.git on the branch dturner/pluggable-backends-preamble