Re: [PATCH 6/6] Use new compress helpers in builtin-pack-objects.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Marco Costalba" <mcostalba@xxxxxxxxx> writes:

> On Jan 10, 2008 10:34 PM, Marco Costalba <mcostalba@xxxxxxxxx> wrote:
>>
>> -               while (deflate(&stream, Z_FINISH) == Z_OK)
>> -                       /* nothing */;
>> -               deflateEnd(&stream);
>> -               datalen = stream.total_out;
>> -               deflateEnd(&stream);
>
>
> One thing I would like someone to clarify is why deflateEnd(&stream)
> is called two times ?

I'd call it an insufficient reviewing while accepting

    http://thread.gmane.org/gmane.comp.version-control.git/45996

In fact, the second deflateEnd() has always been returning
Z_STREAM_ERROR.  We just never checked the error return from
that particular deflateEnd().

The first one returns 0 for success.  We might want to tighten
the check even more to check that.

-- >8 --
pack-objects: remove redundant call to deflateEnd()

We somehow called deflateEnd() on a stream that we have called
deflateEnd() on already.

Noticed by Marco.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 builtin-pack-objects.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index a39cb82..ec10238 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -445,7 +445,7 @@ static unsigned long write_object(struct sha1file *f,
 			/* nothing */;
 		deflateEnd(&stream);
 		datalen = stream.total_out;
-		deflateEnd(&stream);
+
 		/*
 		 * The object header is a byte of 'type' followed by zero or
 		 * more bytes of length.


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux