summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e702496)
raw | patch | inline | side by side (parent: e702496)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 23 Aug 2006 20:57:23 +0000 (13:57 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 23 Aug 2006 20:57:23 +0000 (13:57 -0700) |
In the same spirit as hashcmp() and hashcpy().
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
blame.c | patch | blob | history | |
builtin-update-ref.c | patch | blob | history | |
cache.h | patch | blob | history | |
diff-lib.c | patch | blob | history | |
http-push.c | patch | blob | history | |
sha1_name.c | patch | blob | history |
index 5a8af726230611ff72de545bd013224895093a4b..8968046b0045633e6046c3126978819e9910a5f2 100644 (file)
--- a/blame.c
+++ b/blame.c
blame_file = pathname;
pathspec[0] = pathname;
pathspec[1] = NULL;
- memset(blob_sha1, 0, sizeof(blob_sha1));
+ hashclr(blob_sha1);
read_tree_recursive(t, "", 0, 0, pathspec, get_blob_sha1_internal);
for (i = 0; i < 20; i++) {
diff --git a/builtin-update-ref.c b/builtin-update-ref.c
index 5bd71825fdc48392952faf170efe98c072c7e482..90a3da53ad003a82781e6d4acfc7815c8f15f24f 100644 (file)
--- a/builtin-update-ref.c
+++ b/builtin-update-ref.c
if (get_sha1(value, sha1))
die("%s: not a valid SHA1", value);
- memset(oldsha1, 0, 20);
+ hashclr(oldsha1);
if (oldval && get_sha1(oldval, oldsha1))
die("%s: not a valid old SHA1", oldval);
index cc3f00c2b8dd868bf9069140b8ed081f1c3e5220..e00505a343a2260055f5177bdfd7740e2d5a5e33 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -222,6 +222,10 @@ static inline void hashcpy(unsigned char *sha_dst, const unsigned char *sha_src)
{
memcpy(sha_dst, sha_src, 20);
}
+static inline void hashclr(unsigned char *hash)
+{
+ memset(hash, 0, 20);
+}
int git_mkstemp(char *path, size_t n, const char *template);
diff --git a/diff-lib.c b/diff-lib.c
index 2fc41263aee87547cd755c96bb6f7c345d4b2550..9edfa9262622c64edecfaf7b4f72a79873b8882a 100644 (file)
--- a/diff-lib.c
+++ b/diff-lib.c
memcpy(dpath->path, ce->name, path_len);
dpath->path[path_len] = '\0';
dpath->mode = 0;
- memset(dpath->sha1, 0, 20);
+ hashclr(dpath->sha1);
memset(&(dpath->parent[0]), 0,
sizeof(struct combine_diff_parent)*5);
diff --git a/http-push.c b/http-push.c
index ebfcc73a9ef7abb20f149ca433c9bd67649854d3..8df7a0d576bfacab5ff61e0b6798cb2718401f5d 100644 (file)
--- a/http-push.c
+++ b/http-push.c
@@ -2164,7 +2164,7 @@ static void fetch_symref(const char *path, char **symref, unsigned char *sha1)
if (*symref != NULL)
free(*symref);
*symref = NULL;
- memset(sha1, 0, 20);
+ hashclr(sha1);
if (buffer.posn == 0)
return;
diff --git a/sha1_name.c b/sha1_name.c
index 89b9e3b77af068b93e720dc03e71ad189fefb116..3f6b77ccfadab14453a76b6654b50b186c9f5b25 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
if (len < MINIMUM_ABBREV)
return -1;
- memset(res, 0, 20);
+ hashclr(res);
memset(canonical, 'x', 40);
for (i = 0; i < len ;i++) {
unsigned char c = name[i];