From: Olivier Galibert Date: Sat, 16 Jun 2007 22:15:06 GMT Subject: Re: Fix up ugly open-coded "alloc_nr()" user in object.c Message-ID: <20070616221506.GA78651@dspnet.fr.eu.org> In-Reply-To: <20070616182134.GA22003@coredump.intra.peff.net> On Sat, Jun 16, 2007 at 02:21:34PM -0400, Jeff King wrote: > How about using the new ALLOC_GROW macro to make it even shorter? I also > got rid of the aliased variables, which IMO just make it harder to see > what's going on. > + ALLOC_GROW(array->objects, array->nr, array->alloc); > + array->objects[array->nr].item = obj; > + array->objects[array->nr].name = name; > + array->objects[array->nr].mode = mode; > + array->nr++; Unless the ALLOC_GROW semantics are weird, shouldn't that be: ALLOC_GROW(array->objects, array->nr+1, array->alloc); OG.