Re: [PATCH 12/18] alternates: use a separate scratch space

2016-10-04 Thread Jeff King
On Tue, Oct 04, 2016 at 02:49:45PM -0700, Junio C Hamano wrote: > >> It is not wrong per-se, but I am a bit surprised to see that the > >> code keeps FLEX_ARRAY _and_ uses a separate malloc'ed area pointed > >> at by the scratch pointer. > > > > Yeah, there's really no reason "path" could not beco

Re: [PATCH 12/18] alternates: use a separate scratch space

2016-10-04 Thread Junio C Hamano
Jeff King writes: > On Tue, Oct 04, 2016 at 02:29:46PM -0700, Junio C Hamano wrote: > >> Jeff King writes: >> >> > extern struct alternate_object_database { >> >struct alternate_object_database *next; >> > + >> >char *name; >> > - char base[FLEX_ARRAY]; /* more */ >> > + char *scratc

Re: [PATCH 12/18] alternates: use a separate scratch space

2016-10-04 Thread Jeff King
On Tue, Oct 04, 2016 at 02:29:46PM -0700, Junio C Hamano wrote: > Jeff King writes: > > > extern struct alternate_object_database { > > struct alternate_object_database *next; > > + > > char *name; > > - char base[FLEX_ARRAY]; /* more */ > > + char *scratch; > > + > > + char path[

Re: [PATCH 12/18] alternates: use a separate scratch space

2016-10-04 Thread Junio C Hamano
Jeff King writes: > extern struct alternate_object_database { > struct alternate_object_database *next; > + > char *name; > - char base[FLEX_ARRAY]; /* more */ > + char *scratch; > + > + char path[FLEX_ARRAY]; > } *alt_odb_list; It is not wrong per-se, but I am a bit su

Re: [PATCH 12/18] alternates: use a separate scratch space

2016-10-03 Thread Jacob Keller
On Mon, Oct 3, 2016 at 1:35 PM, Jeff King wrote: > The alternate_object_database struct uses a single buffer > both for storing the path to the alternate, and as a scratch > buffer for forming object names. This is efficient (since > otherwise we'd end up storing the path twice), but it makes > li

[PATCH 12/18] alternates: use a separate scratch space

2016-10-03 Thread Jeff King
The alternate_object_database struct uses a single buffer both for storing the path to the alternate, and as a scratch buffer for forming object names. This is efficient (since otherwise we'd end up storing the path twice), but it makes life hard for callers who just want to know the path to the al