Re: [PATCH] fast-import: Reinitialize command_buf rather than detach it.

2019-08-25 Thread René Scharfe
Am 25.08.19 um 06:13 schrieb Mike Hommey: > command_buf.buf is also stored in cmd_hist, so instead of > strbuf_release, the current code uses strbuf_detach in order to > "leak" the buffer as far as the strbuf is concerned. Hmm. > However, strbuf_detach does more than "leak" the strbuf buffer: it

Re: [PATCH] fast-import: Reinitialize command_buf rather than detach it.

2019-08-25 Thread Jeff King
On Sun, Aug 25, 2019 at 04:20:31PM +0900, Mike Hommey wrote: > > I think this is stronger than just "most of the time". It's an invariant > > for strbufs to have a NUL, so the only case where detaching isn't a noop > > is the empty slopbuf case you mention. > > If it's an invariant, why does deta

Re: [PATCH] fast-import: Reinitialize command_buf rather than detach it.

2019-08-25 Thread Mike Hommey
On Sun, Aug 25, 2019 at 02:57:48AM -0400, Jeff King wrote: > On Sun, Aug 25, 2019 at 01:13:48PM +0900, Mike Hommey wrote: > > > command_buf.buf is also stored in cmd_hist, so instead of > > strbuf_release, the current code uses strbuf_detach in order to > > "leak" the buffer as far as the strbuf i

Re: [PATCH] fast-import: Reinitialize command_buf rather than detach it.

2019-08-24 Thread Jeff King
On Sun, Aug 25, 2019 at 01:13:48PM +0900, Mike Hommey wrote: > command_buf.buf is also stored in cmd_hist, so instead of > strbuf_release, the current code uses strbuf_detach in order to > "leak" the buffer as far as the strbuf is concerned. > > However, strbuf_detach does more than "leak" the st

[PATCH] fast-import: Reinitialize command_buf rather than detach it.

2019-08-24 Thread Mike Hommey
command_buf.buf is also stored in cmd_hist, so instead of strbuf_release, the current code uses strbuf_detach in order to "leak" the buffer as far as the strbuf is concerned. However, strbuf_detach does more than "leak" the strbuf buffer: it possibly reallocates it to ensure a terminating nul char