summaryrefslogtreecommitdiff
path: root/http-walker.c
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2018-01-17 18:54:54 +0100
committerJunio C Hamano <gitster@pobox.com>2018-01-17 12:21:32 -0800
commitea6577303f4059683f8f257bdecbcafb05001ce9 (patch)
tree1ac60041f78ab7af5f557bc8b2028b73994bfa52 /http-walker.c
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-ea6577303f4059683f8f257bdecbcafb05001ce9.tar.gz
sha1_file: remove static strbuf from sha1_file_name()
Using a static buffer in sha1_file_name() is error prone and the performance improvements it gives are not needed in many of the callers. So let's get rid of this static buffer and, if necessary or helpful, let's use one in the caller. Suggested-by: Jeff Hostetler <git@jeffhostetler.com> Helped-by: Kevin Daudt <me@ikke.info> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-walker.c')
-rw-r--r--http-walker.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/http-walker.c b/http-walker.c
index 1ae8363de2..07c2b1af82 100644
--- a/http-walker.c
+++ b/http-walker.c
@@ -544,8 +544,10 @@ static int fetch_object(struct walker *walker, unsigned char *sha1)
} else if (hashcmp(obj_req->sha1, req->real_sha1)) {
ret = error("File %s has bad hash", hex);
} else if (req->rename < 0) {
- ret = error("unable to write sha1 filename %s",
- sha1_file_name(req->sha1));
+ struct strbuf buf = STRBUF_INIT;
+ sha1_file_name(&buf, req->sha1);
+ ret = error("unable to write sha1 filename %s", buf.buf);
+ strbuf_release(&buf);
}
release_http_object_request(req);