Re: [PATCH] branch: reset instead of release a strbuf

2017-10-03 Thread Junio C Hamano
Jeff King writes: >> /** >> * Release a string buffer and the memory it used. You should not use the >> - * string buffer after using this function, unless you initialize it again. >> + * string buffer after using this function. >> */ >> extern void strbuf_release(struct strbuf *); > > I th

Re: [PATCH] branch: reset instead of release a strbuf

2017-10-03 Thread Jeff King
On Tue, Oct 03, 2017 at 03:24:14PM -0700, Jonathan Nieder wrote: > Here's a patch to address the surprising strbuf.h advice. > > -- >8 -- > Subject: strbuf: do not encourage init-after-release > > strbuf_release already leaves the strbuf in a valid, initialized > state, so there is not need to c

Re: [PATCH] branch: reset instead of release a strbuf

2017-10-03 Thread Jonathan Nieder
Hi, Stefan Beller wrote: > Our documentation advises to not re-use a strbuf, after strbuf_release > has been called on it. Use the proper reset instead. > > Reviewed-by: Jonathan Nieder This is indeed Reviewed-by: Jonathan Nieder Thank you. > Signed-off-by: Stefan Beller > --- > builtin/br

Re: [PATCH] branch: reset instead of release a strbuf

2017-10-03 Thread Jonathan Nieder
Hi, Stefan Beller wrote: > Our documentation advises to not re-use a strbuf, after strbuf_release > has been called on it. Use the proper reset instead. I'm super surprised at this documentation. strbuf_release maintains the invariant that a strbuf is always usable (i.e., that we do not have to