Re: [PATCH 3/4] push: prepare sender to receive extended ref information from the receiver
- From
Jeff King <peff@peff.net>
- Date
- Sep 9, 2008, 13:03 UTC
- Message-ID
- <20080909130320.GA25935@coredump.intra.peff.net>
- In-Reply-To
- <1220948830-3275-4-git-send-email-gitster@pobox.com>
On Tue, Sep 09, 2008 at 01:27:09AM -0700, Junio C Hamano wrote:
> +struct extra_have_objects {
> + int nr, alloc;
> + unsigned char (*array)[20];
> +};This declaration made me double-take. I think it is correct, and you are saving an extra pointer over a malloc. But the syntax ends up a little confusing:
hashcpy(&(extra->array[extra->nr][0]), sha1);
Using a struct probably would have been a little easier to read. I don't know if this is worth changing.
> + if (extra->alloc <= extra->nr) > + ALLOC_GROW(extra->array, extra->nr + 1, extra->alloc);
Isn't the conditional superfluous (ALLOC_GROW already makes this check)?
-Peff