diff options
author | Shawn Pearce <spearce@spearce.org> | 2006-08-23 02:49:00 -0400 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-23 13:53:10 -0700 |
commit | e702496e434a160f798447b95b9cea3cd138c140 (patch) | |
tree | 76b73202f627b69604b8a6e7d0e2f9c5eb0e27a9 /tree-walk.c | |
parent | b05faa2da9ec24d737bbba47c71e815255f3eaa7 (diff) | |
download | git-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 'tree-walk.c')
-rw-r--r-- | tree-walk.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tree-walk.c b/tree-walk.c index 3f83e98f3a..14cc5aea6c 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -179,7 +179,7 @@ static int find_tree_entry(struct tree_desc *t, const char *name, unsigned char if (cmp < 0) break; if (entrylen == namelen) { - memcpy(result, sha1, 20); + hashcpy(result, sha1); return 0; } if (name[entrylen] != '/') @@ -187,7 +187,7 @@ static int find_tree_entry(struct tree_desc *t, const char *name, unsigned char if (!S_ISDIR(*mode)) break; if (++entrylen == namelen) { - memcpy(result, sha1, 20); + hashcpy(result, sha1); return 0; } return get_tree_entry(sha1, name + entrylen, result, mode); |