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

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2007-02-19 03:48:50
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.

> +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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Mon Feb 19 03:49:05 2007

This archive was generated by hypermail 2.1.8 : 2007-02-19 03:51:27 EST