use oid_to_hex_r() for converting struct object_id hashes to hex strings

Patch generated by Coccinelle and contrib/coccinelle/object_id.cocci.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2017-01-28 23:03:03 +01:00 committed by Junio C Hamano
parent 4e59582ff7
commit 2490574d15
4 changed files with 5 additions and 5 deletions

View File

@ -1901,7 +1901,7 @@ static void emit_porcelain(struct scoreboard *sb, struct blame_entry *ent,
struct origin *suspect = ent->suspect; struct origin *suspect = ent->suspect;
char hex[GIT_SHA1_HEXSZ + 1]; char hex[GIT_SHA1_HEXSZ + 1];
sha1_to_hex_r(hex, suspect->commit->object.oid.hash); oid_to_hex_r(hex, &suspect->commit->object.oid);
printf("%s %d %d %d\n", printf("%s %d %d %d\n",
hex, hex,
ent->s_lno + 1, ent->s_lno + 1,
@ -1941,7 +1941,7 @@ static void emit_other(struct scoreboard *sb, struct blame_entry *ent, int opt)
int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP); int show_raw_time = !!(opt & OUTPUT_RAW_TIMESTAMP);
get_commit_info(suspect->commit, &ci, 1); get_commit_info(suspect->commit, &ci, 1);
sha1_to_hex_r(hex, suspect->commit->object.oid.hash); oid_to_hex_r(hex, &suspect->commit->object.oid);
cp = nth_line(sb, ent->lno); cp = nth_line(sb, ent->lno);
for (cnt = 0; cnt < ent->num_lines; cnt++) { for (cnt = 0; cnt < ent->num_lines; cnt++) {

View File

@ -22,7 +22,7 @@ static int merge_entry(int pos, const char *path)
if (strcmp(ce->name, path)) if (strcmp(ce->name, path))
break; break;
found++; found++;
sha1_to_hex_r(hexbuf[stage], ce->oid.hash); oid_to_hex_r(hexbuf[stage], &ce->oid);
xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode); xsnprintf(ownbuf[stage], sizeof(ownbuf[stage]), "%o", ce->ce_mode);
arguments[stage] = hexbuf[stage]; arguments[stage] = hexbuf[stage];
arguments[stage + 4] = ownbuf[stage]; arguments[stage + 4] = ownbuf[stage];

View File

@ -237,7 +237,7 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
cnt = reaches; cnt = reaches;
if (revs->commits) if (revs->commits)
sha1_to_hex_r(hex, revs->commits->item->object.oid.hash); oid_to_hex_r(hex, &revs->commits->item->object.oid);
if (flags & BISECT_SHOW_ALL) { if (flags & BISECT_SHOW_ALL) {
traverse_commit_list(revs, show_commit, show_object, info); traverse_commit_list(revs, show_commit, show_object, info);

2
diff.c
View File

@ -3015,7 +3015,7 @@ static struct diff_tempfile *prepare_temp_file(const char *name,
if (!one->oid_valid) if (!one->oid_valid)
sha1_to_hex_r(temp->hex, null_sha1); sha1_to_hex_r(temp->hex, null_sha1);
else else
sha1_to_hex_r(temp->hex, one->oid.hash); oid_to_hex_r(temp->hex, &one->oid);
/* Even though we may sometimes borrow the /* Even though we may sometimes borrow the
* contents from the work tree, we always want * contents from the work tree, we always want
* one->mode. mode is trustworthy even when * one->mode. mode is trustworthy even when