summaryrefslogtreecommitdiff
path: root/archive-zip.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-06-10 10:55:10 -0700
committerJunio C Hamano <gitster@pobox.com>2011-06-10 11:10:29 -0700
commit55bb5c9147a209eba44c3e9866704ece424c3d31 (patch)
tree1b3561115345d0b236085d741da75390cb1e759b /archive-zip.c
parent5e86c1fb866ca4bc8d6e015ccbdafd114fd616fa (diff)
downloadgit-55bb5c9147a209eba44c3e9866704ece424c3d31.tar.gz
zlib: wrap deflate side of the API
Wrap deflateInit, deflate, and deflateEnd for everybody, and the sole use of deflateInit2 in remote-curl.c to tell the library to use gzip header and trailer in git_deflate_init_gzip(). There is only one caller that cares about the status from deflateEnd(). Introduce git_deflate_end_gently() to let that sole caller retrieve the status and act on it (i.e. die) for now, but we would probably want to make inflate_end/deflate_end die when they ran out of memory and get rid of the _gently() kind. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive-zip.c')
-rw-r--r--archive-zip.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/archive-zip.c b/archive-zip.c
index cf285044e3..081ff830c8 100644
--- a/archive-zip.c
+++ b/archive-zip.c
@@ -96,7 +96,7 @@ static void *zlib_deflate(void *data, unsigned long size,
int result;
memset(&stream, 0, sizeof(stream));
- deflateInit(&stream, compression_level);
+ git_deflate_init(&stream, compression_level);
maxsize = deflateBound(&stream, size);
buffer = xmalloc(maxsize);
@@ -106,7 +106,7 @@ static void *zlib_deflate(void *data, unsigned long size,
stream.avail_out = maxsize;
do {
- result = deflate(&stream, Z_FINISH);
+ result = git_deflate(&stream, Z_FINISH);
} while (result == Z_OK);
if (result != Z_STREAM_END) {
@@ -114,7 +114,7 @@ static void *zlib_deflate(void *data, unsigned long size,
return NULL;
}
- deflateEnd(&stream);
+ git_deflate_end(&stream);
*compressed_size = stream.total_out;
return buffer;