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

Re: [PATCH 1/2] Add `struct object_hash`

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 18, 2007, 16:48 UTC
Message-ID
<Pine.LNX.4.63.0702181740100.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vtzxjj24j.fsf@assigned-by-dhcp.cox.net>
Hi,
These are only minor nits, as I think your code is bug free.
On Sun, 18 Feb 2007, Junio C Hamano wrote:
> +static void insert_object_into_hash(struct object_hash_entry *ent, struct object_hash *hash)
I'd rather _not_ name it "ent", as that has a different meaning already.

Also, what is your preferred width? Your line is way longer than 80 columns.

Show 9 quoted lines
> +static void grow_object_hash(struct object_hash *hash)
> +{
> +	struct object_hash_entry **old_hash = hash->hash;
> +	int i;
> +	int old_size = hash->size;
> +	int new_size = (old_size + 1000) * 3 / 2;
> +
> +	hash->hash = xcalloc(new_size, sizeof(struct object_hash_entry *));
> +	hash->size = new_size;
Either have a "new_hash" variable, or get rid of "new_size".

BTW I just tried to convert obj_hash to this interface, and it seems that there really is no elegant way (without wasting memory; You could do it, but then you'd have _two_ pointers for each object: one to the object_hash_entry, and from _that_ to the object). Maybe you have a clever way to solve this?

Ciao, Dscho

Previous: Johannes Schindelin
Message 4 of 4 in “Add `struct object_hash`”
  1. 1/2 Add `struct object_hash`Johannes Schindelin, Feb 17, 2007
  2. Junio C HamanoFeb 18, 2007
  3. Johannes SchindelinFeb 18, 2007
  4. Johannes SchindelinFeb 18, 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.