summaryrefslogtreecommitdiff
path: root/zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'zlib.c')
-rw-r--r--zlib.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/zlib.c b/zlib.c
index 2b2c0c780e..61e6df0fdc 100644
--- a/zlib.c
+++ b/zlib.c
@@ -168,13 +168,8 @@ void git_deflate_init(git_zstream *strm, int level)
strm->z.msg ? strm->z.msg : "no message");
}
-void git_deflate_init_gzip(git_zstream *strm, int level)
+static void do_git_deflate_init(git_zstream *strm, int level, int windowBits)
{
- /*
- * Use default 15 bits, +16 is to generate gzip header/trailer
- * instead of the zlib wrapper.
- */
- const int windowBits = 15 + 16;
int status;
zlib_pre_call(strm);
@@ -188,6 +183,24 @@ void git_deflate_init_gzip(git_zstream *strm, int level)
strm->z.msg ? strm->z.msg : "no message");
}
+void git_deflate_init_gzip(git_zstream *strm, int level)
+{
+ /*
+ * Use default 15 bits, +16 is to generate gzip header/trailer
+ * instead of the zlib wrapper.
+ */
+ do_git_deflate_init(strm, level, 15 + 16);
+}
+
+void git_deflate_init_raw(git_zstream *strm, int level)
+{
+ /*
+ * Use default 15 bits, negate the value to get raw compressed
+ * data without zlib header and trailer.
+ */
+ do_git_deflate_init(strm, level, -15);
+}
+
int git_deflate_abort(git_zstream *strm)
{
int status;