Re: [PATCH] refs: Use binary search to lookup refs faster
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 29, 2011, 22:06 UTC
- Message-ID
- <7vvcsbqa0k.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20110929041811.5363.33396.julian@quantumfyre.co.uk>
Julian Phillips <julian@quantumfyre.co.uk> writes:
Show 12 quoted lines
> +static void add_ref(const char *name, const unsigned char *sha1,
> + int flag, struct ref_array *refs,
> + struct ref_entry **new_entry)
> {
> int len;
> - struct ref_list *entry;
> + struct ref_entry *entry;
>
> /* Allocate it and add it in.. */
> len = strlen(name) + 1;
> - entry = xmalloc(sizeof(struct ref_list) + len);
> + entry = xmalloc(sizeof(struct ref) + len);This should be sizeof(struct ref_entry), no? There is another such misallocation in search_ref_array() where it prepares a temporary.