All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy()
@ 2014-02-27 14:58 Sun He
  2014-02-27 21:45 ` Michael Haggerty
  0 siblings, 1 reply; 2+ messages in thread
From: Sun He @ 2014-02-27 14:58 UTC (permalink / raw)
  To: git; +Cc: mhagger, Sun He


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++;
 }
-- 
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.*\)


Cheers,
He Sun

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy()
  2014-02-27 14:58 [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy() Sun He
@ 2014-02-27 21:45 ` Michael Haggerty
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Haggerty @ 2014-02-27 21:45 UTC (permalink / raw)
  To: Sun He; +Cc: git

On 02/27/2014 03:58 PM, Sun He wrote:
> 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.

> -- 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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-02-27 21:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27 14:58 [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy() Sun He
2014-02-27 21:45 ` Michael Haggerty

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.