Marco Costalba [off-list ref] writes:
quoted hunk ↗ jump to hunk
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?