зеркало из https://github.com/microsoft/git.git
Convert memset(hash,0,20) to hashclr(hash).
In the same spirit as hashcmp() and hashcpy(). Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Родитель
e702496e43
Коммит
a8e0d16d85
2
blame.c
2
blame.c
|
@ -165,7 +165,7 @@ static int get_blob_sha1(struct tree *t, const char *pathname,
|
|||
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++) {
|
||||
|
|
|
@ -44,7 +44,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
|
|||
|
||||
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);
|
||||
|
||||
|
|
4
cache.h
4
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);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ int run_diff_files(struct rev_info *revs, int silent_on_removed)
|
|||
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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -159,7 +159,7 @@ static int get_short_sha1(const char *name, int len, unsigned char *sha1,
|
|||
|
||||
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];
|
||||
|
|
Загрузка…
Ссылка в новой задаче