提交 90d05713 编写于 作者: T Tay Ray Chuan 提交者: Junio C Hamano

http.c::new_http_pack_request: do away with the temp variable filename

Now that the temporary variable char *filename is only used in one
place, do away with it and just call sha1_pack_name() directly.
Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
Acked-by: NShawn O. Pearce <spearce@spearce.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 750ef425
...@@ -1077,7 +1077,6 @@ int finish_http_pack_request(struct http_pack_request *preq) ...@@ -1077,7 +1077,6 @@ int finish_http_pack_request(struct http_pack_request *preq)
struct http_pack_request *new_http_pack_request( struct http_pack_request *new_http_pack_request(
struct packed_git *target, const char *base_url) struct packed_git *target, const char *base_url)
{ {
char *filename;
long prev_posn = 0; long prev_posn = 0;
char range[RANGE_HEADER_SIZE]; char range[RANGE_HEADER_SIZE];
struct strbuf buf = STRBUF_INIT; struct strbuf buf = STRBUF_INIT;
...@@ -1092,8 +1091,8 @@ struct http_pack_request *new_http_pack_request( ...@@ -1092,8 +1091,8 @@ struct http_pack_request *new_http_pack_request(
sha1_to_hex(target->sha1)); sha1_to_hex(target->sha1));
preq->url = strbuf_detach(&buf, NULL); preq->url = strbuf_detach(&buf, NULL);
filename = sha1_pack_name(target->sha1); snprintf(preq->tmpfile, sizeof(preq->tmpfile), "%s.temp",
snprintf(preq->tmpfile, sizeof(preq->tmpfile), "%s.temp", filename); sha1_pack_name(target->sha1));
preq->packfile = fopen(preq->tmpfile, "a"); preq->packfile = fopen(preq->tmpfile, "a");
if (!preq->packfile) { if (!preq->packfile) {
error("Unable to open local file %s for pack", error("Unable to open local file %s for pack",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册