path: root/walker.c
diff options
authorJeff King <>2015-09-24 21:08:05 (GMT)
committerJunio C Hamano <>2015-10-05 18:08:05 (GMT)
commit2b87d3a89633fb6078203a77d2610175f94cef95 (patch)
treeec2dfe90aeb08635bbe14b1e51b1503e6acc1d40 /walker.c
parentd59f765ac9b3d6fc2e6bea262222b80493055f12 (diff)
drop strcpy in favor of raw sha1_to_hex
In some cases where we strcpy() the result of sha1_to_hex(), there's no need; the result goes directly into a printf statement, and we can simply pass the return value from sha1_to_hex() directly. When this code was originally written, sha1_to_hex used a single buffer, and it was not safe to use it twice within a single expression. That changed as of dcb3450 (sha1_to_hex() usage cleanup, 2006-05-03), but this code was never updated. History-dug-by: Eric Sunshine <> Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'walker.c')
1 files changed, 2 insertions, 3 deletions
diff --git a/walker.c b/walker.c
index 44a936c..cdeb63f 100644
--- a/walker.c
+++ b/walker.c
@@ -17,10 +17,9 @@ void walker_say(struct walker *walker, const char *fmt, const char *hex)
static void report_missing(const struct object *obj)
- char missing_hex[41];
- strcpy(missing_hex, sha1_to_hex(obj->sha1));
fprintf(stderr, "Cannot obtain needed %s %s\n",
- obj->type ? typename(obj->type): "object", missing_hex);
+ obj->type ? typename(obj->type): "object",
+ sha1_to_hex(obj->sha1));
if (!is_null_sha1(current_commit_sha1))
fprintf(stderr, "while processing commit %s.\n",