git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fix up ugly open-coded "alloc_nr()" user in object.c

From
OGOlivier Galibert <galibert@pobox.com>
Date
Jun 16, 2007, 22:15 UTC
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
Show 6 quoted lines
> 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.
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “Fix up ugly open-coded "alloc_nr()" user in object.c”
  1. Linus TorvaldsJun 16, 2007
  2. Jeff KingJun 16, 2007
  3. Olivier GalibertJun 16, 2007
  4. Jeff KingJun 16, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.