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>
This commit is contained in:
committed by
Junio C Hamano
parent
3013dff866
commit
ea6577303f
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user