Commit 4834ca9697f0ad310b1608d2ca08a667742c5d7c

Stefan Sperling 2018-03-13T19:03:55

add a macro for zbuf buffer size

diff --git a/lib/got_zbuf_lib.h b/lib/got_zbuf_lib.h
index 083cd85..066d182 100644
--- a/lib/got_zbuf_lib.h
+++ b/lib/got_zbuf_lib.h
@@ -24,6 +24,8 @@ struct got_zstream_buf {
 #define GOT_ZSTREAM_F_HAVE_MORE 0x01
 };
 
+#define GOT_ZSTREAM_BUFSIZE	8192
+
 const struct got_error *got_inflate_init(struct got_zstream_buf *, size_t);
 const struct got_error *got_inflate_read(struct got_zstream_buf *, FILE *,
     size_t *);
diff --git a/lib/zbuf.c b/lib/zbuf.c
index dcdf5a7..4d83cf8 100644
--- a/lib/zbuf.c
+++ b/lib/zbuf.c
@@ -115,7 +115,7 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
 	struct got_zstream_buf zb;
 	void *newbuf;
 
-	err = got_inflate_init(&zb, 8192);
+	err = got_inflate_init(&zb, GOT_ZSTREAM_BUFSIZE);
 	if (err)
 		return err;
 
@@ -153,7 +153,7 @@ got_inflate_to_file(size_t *outlen, FILE *infile, FILE *outfile)
 	size_t avail;
 	struct got_zstream_buf zb;
 
-	err = got_inflate_init(&zb, 8192);
+	err = got_inflate_init(&zb, GOT_ZSTREAM_BUFSIZE);
 	if (err)
 		goto done;