]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bisect: use oid_to_hex_r() instead of memcpy()+oid_to_hex()
authorRené Scharfe <l.s.r@web.de>
Sun, 2 Aug 2020 14:36:50 +0000 (16:36 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 2 Aug 2020 20:02:52 +0000 (13:02 -0700)
Write the hexadecimal object ID directly into the destination buffer
using oid_to_hex_r() instead of writing it into a static buffer first
using oid_to_hex() and then copying it from there using memcpy().
This is shorter, simpler and a bit more efficient.

Reviewed-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c

index d5e830410f5949d1e8c24e990cf0a70b980656ea..be3ff1e9625c0bd46b7125a6621d603b866b5d83 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -709,7 +709,7 @@ static enum bisect_error bisect_checkout(const struct object_id *bisect_rev, int
        char bisect_rev_hex[GIT_MAX_HEXSZ + 1];
        enum bisect_error res = BISECT_OK;
 
-       memcpy(bisect_rev_hex, oid_to_hex(bisect_rev), the_hash_algo->hexsz + 1);
+       oid_to_hex_r(bisect_rev_hex, bisect_rev);
        update_ref(NULL, "BISECT_EXPECTED_REV", bisect_rev, NULL, 0, UPDATE_REFS_DIE_ON_ERR);
 
        argv_checkout[2] = bisect_rev_hex;