Re: [PATCH 08/11] Use new decompress_all() helper in git

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

 



Marco Costalba <mcostalba@xxxxxxxxx> writes:

> Only in two places is possible to really simplify
> diff --git a/index-pack.c b/index-pack.c
> index 880088e..30d7837 100644
> --- a/index-pack.c
> +++ b/index-pack.c
> @@ -169,24 +169,18 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size)
>  	z_stream stream;
>  	void *buf = xmalloc(size);
>  
> -	memset(&stream, 0, sizeof(stream));
> -	stream.next_out = buf;
> -	stream.avail_out = size;
> -	stream.next_in = fill(1);
> -	stream.avail_in = input_len;
> -	inflateInit(&stream);
> +	decompress_alloc(&stream);
> +	decompress_into(&stream, buf, size);
>  
>  	for (;;) {
> -		int ret = inflate(&stream, 0);
> +		int ret = decompress_next_from(&stream, fill(1), input_len, Z_NO_FLUSH);

The input_len variable is changed as a side effect of calling
the fill() function.  Don't you have the same issue that you
handle with [10/11] here?
-
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