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

Re: [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Feb 27, 2014, 21:45 UTC
Message-ID
<530FB1E0.5030501@alum.mit.edu>
In-Reply-To
<1393513127-32399-1-git-send-email-sunheehnus@gmail.com>
On 02/27/2014 03:58 PM, Sun He wrote:
Show 19 quoted lines
> Signed-off-by: Sun He <sunheehnus@gmail.com>
> ---
>  bundle.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/bundle.c b/bundle.c
> index e99065c..7809fbb 100644
> --- a/bundle.c
> +++ b/bundle.c
> @@ -19,7 +19,7 @@ static void add_to_ref_list(const unsigned char *sha1, const char *name,
>  		list->list = xrealloc(list->list,
>  				list->alloc * sizeof(list->list[0]));
>  	}
> -	memcpy(list->list[list->nr].sha1, sha1, 20);
> +	hashcpy(list->list[list->nr].sha1, sha1);
>  	list->list[list->nr].name = xstrdup(name);
>  	list->nr++;
>  }
> 

Correct (except for the patch formatting problems I mentioned WRT your other patch). Please also note that the subject line after "[PATCH...]" is taken as the first line of the commit message, so it is inappropriate to mention "GSoC2014" etc. there.

Show 9 quoted lines
> -- 1.7.1
>> See if you can find other places where hashcpy() should be used instead of memcpy()
> grep.c:grep_source_init()
> reflog-walk.c:read_one_reflog()
> ppc/sha1.c:ppc_SHA1_Final()
> refs.c:resolve_gitlink_packed_ref()
> 
> We can find those by the shell command:
> $ find . | xargs grep "memcpy\(.*20.*\)

It would have been much more helpful if you had submitted patches to fix those other sites.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Sun He
Message 2 of 2 in “GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy()”
  1. GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy()Sun He, Feb 27, 2014
  2. Michael HaggertyFeb 27, 2014

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.