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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 11, 2008, 15:32 UTC
Message-ID
<alpine.DEB.1.00.0805111630590.30431@racer>
In-Reply-To
<1210462018-47060-1-git-send-email-kkowalczyk@gmail.com>
Hi,
On Sat, 10 May 2008, kkowalczyk@gmail.com wrote:
Show 14 quoted lines
> 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

Previous: Junio C Hamano
Message 8 of 8 in “Optimize common pattern of alloc_ref from string”
  1. Optimize common pattern of alloc_ref from stringkkowalczyk@gmail.com, May 10, 2008
  2. Jeff KingMay 10, 2008
  3. Krzysztof KowalczykMay 11, 2008
  4. Jeff KingMay 11, 2008
  5. Junio C HamanoMay 11, 2008
  6. Krzysztof KowalczykMay 11, 2008
  7. Junio C HamanoMay 11, 2008
  8. Johannes SchindelinMay 11, 2008

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.