diff options
author | Jeff King <peff@peff.net> | 2015-09-24 17:08:05 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-05 11:08:05 -0700 |
commit | 2b87d3a89633fb6078203a77d2610175f94cef95 (patch) | |
tree | ec2dfe90aeb08635bbe14b1e51b1503e6acc1d40 /http-push.c | |
parent | d59f765ac9b3d6fc2e6bea262222b80493055f12 (diff) | |
download | git-2b87d3a89633fb6078203a77d2610175f94cef95.tar.gz |
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 <sunshine@sunshineco.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-push.c')
-rw-r--r-- | http-push.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/http-push.c b/http-push.c index 43a9036594..48f39b7f71 100644 --- a/http-push.c +++ b/http-push.c @@ -1856,7 +1856,6 @@ int main(int argc, char **argv) new_refs = 0; for (ref = remote_refs; ref; ref = ref->next) { - char old_hex[60], *new_hex; struct argv_array commit_argv = ARGV_ARRAY_INIT; if (!ref->peer_ref) @@ -1911,13 +1910,12 @@ int main(int argc, char **argv) } hashcpy(ref->new_sha1, ref->peer_ref->new_sha1); new_refs++; - strcpy(old_hex, sha1_to_hex(ref->old_sha1)); - new_hex = sha1_to_hex(ref->new_sha1); fprintf(stderr, "updating '%s'", ref->name); if (strcmp(ref->name, ref->peer_ref->name)) fprintf(stderr, " using '%s'", ref->peer_ref->name); - fprintf(stderr, "\n from %s\n to %s\n", old_hex, new_hex); + fprintf(stderr, "\n from %s\n to %s\n", + sha1_to_hex(ref->old_sha1), sha1_to_hex(ref->new_sha1)); if (dry_run) { if (helper_status) printf("ok %s\n", ref->name); |