summaryrefslogtreecommitdiff
path: root/send-pack.c
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2006-08-23 02:49:00 -0400
committerJunio C Hamano <junkio@cox.net>2006-08-23 13:53:10 -0700
commite702496e434a160f798447b95b9cea3cd138c140 (patch)
tree76b73202f627b69604b8a6e7d0e2f9c5eb0e27a9 /send-pack.c
parentb05faa2da9ec24d737bbba47c71e815255f3eaa7 (diff)
downloadgit-e702496e434a160f798447b95b9cea3cd138c140.tar.gz
Convert memcpy(a,b,20) to hashcpy(a,b).
This abstracts away the size of the hash values when copying them from memory location to memory location, much as the introduction of hashcmp abstracted away hash value comparsion. A few call sites were using char* rather than unsigned char* so I added the cast rather than open hashcpy to be void*. This is a reasonable tradeoff as most call sites already use unsigned char* and the existing hashcmp is also declared to be unsigned char*. [jc: Splitted the patch to "master" part, to be followed by a patch for merge-recursive.c which is not in "master" yet. Fixed the cast in the latter hunk to combine-diff.c which was wrong in the original. Also converted ones left-over in combine-diff.c, diff-lib.c and upload-pack.c ] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'send-pack.c')
-rw-r--r--send-pack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/send-pack.c b/send-pack.c
index f7c0cfc6f6..fd79a61923 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -185,7 +185,7 @@ static int one_local_ref(const char *refname, const unsigned char *sha1)
struct ref *ref;
int len = strlen(refname) + 1;
ref = xcalloc(1, sizeof(*ref) + len);
- memcpy(ref->new_sha1, sha1, 20);
+ hashcpy(ref->new_sha1, sha1);
memcpy(ref->name, refname, len);
*local_tail = ref;
local_tail = &ref->next;
@@ -310,7 +310,7 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec)
continue;
}
}
- memcpy(ref->new_sha1, ref->peer_ref->new_sha1, 20);
+ hashcpy(ref->new_sha1, ref->peer_ref->new_sha1);
if (is_zero_sha1(ref->new_sha1)) {
error("cannot happen anymore");
ret = -3;