git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sun He <sunheehnus@gmail.com>
To: git@vger.kernel.org
Cc: mhagger@alum.mit.edu, Sun He <sunheehnus@gmail.com>
Subject: [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy()
Date: Thu, 27 Feb 2014 22:58:47 +0800	[thread overview]
Message-ID: <1393513127-32399-1-git-send-email-sunheehnus@gmail.com> (raw)


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

             reply	other threads:[~2014-02-27 15:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 14:58 Sun He [this message]
2014-02-27 21:45 ` [PATCH] GSoC2014 microprojects #5 Change bundle.c:add_to_ref_list() to use hashcpy() Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393513127-32399-1-git-send-email-sunheehnus@gmail.com \
    --to=sunheehnus@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).