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 become a non-flex > > buffer. I mostly left it there out of inertia. If you have a preference, > > I'm happy to change it. > > My preference, before reaching the end of the series, actually was > to overallocate just once and point with *scratch into path[] beyond > the end of the fixed "where is the object directory?" string. > > Of course, that would not mesh very well with the plan this series > had after this step to use strbuf for keeping scratch ;-) And the > end result looks fine to me. Heh, yeah, I did not think of that (because I had the strbuf end-game in mind the whole time). I agree that would be nicer if we were keeping the raw buffer, if only because one could free the whole thing in one shot (OTOH, we do not ever free these structs at all :) ). -Peff