Re: [PATCH] Optimize common pattern of alloc_ref from string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sat, 10 May 2008, kkowalczyk@xxxxxxxxx wrote:

> diff --git a/builtin-fetch.c b/builtin-fetch.c
> index e56617e..f6584ec 100644
> --- a/builtin-fetch.c
> +++ b/builtin-fetch.c
> @@ -508,10 +508,8 @@ static void find_non_local_tags(struct transport *transport,
>  		     will_fetch(head, ref->old_sha1))) {
>  			path_list_insert(ref_name, &new_refs);
>  
> -			rm = alloc_ref(strlen(ref_name) + 1);
> -			strcpy(rm->name, ref_name);
> -			rm->peer_ref = alloc_ref(strlen(ref_name) + 1);
> -			strcpy(rm->peer_ref->name, ref_name);
> +			rm = alloc_ref_from_str(ref_name);
> +			rm->peer_ref = alloc_ref_from_str(ref_name);

Thanks.  This was on my ever-growing TODO list (actually, fix alloc_ref() 
to take the string length instead of the size to be allocated).

Together with the comments from Peff I am very positive on this patch.

Thanks,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux