@matheusbsbs / matheus-bagliano / commits / 3065274c58
Fork 0

http.c: Drop useless != NULL test in finish_http_pack_request

The test preq->packfile != NULL is always true. If packfile was actually NULL when entering this function the ftell() above would crash out with a SIGSEGV, resulting in never reaching this point. Simplify the code by just removing the conditional. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shawn O. Pearce committed Apr 17, 2010 at 13:07 UTC 3065274c58a4f4d0c6eef7e29a1484cf2c288131
1 file changed +3 -6
http.c
+3 -6
@@ -1005,12 +1005,9 @@ int finish_http_pack_request(struct http_pack_request *preq)
1005 struct packed_git *p = preq->target;
1006
1007 p->pack_size = ftell(preq->packfile);
1008 -
1009 - if (preq->packfile != NULL) {
1010 - fclose(preq->packfile);
1011 - preq->packfile = NULL;
1012 - preq->slot->local = NULL;
1013 - }
1008 + fclose(preq->packfile);
1009 + preq->packfile = NULL;
1010 + preq->slot->local = NULL;
1011
1012 lst = preq->lst;
1013 while (*lst != p)