summaryrefslogtreecommitdiff
path: root/infback.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-10-07 01:57:07 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-10-07 02:11:56 -0700
commitf442c1e89e99ae5a0068a2d32e7284c2623f09fd (patch)
tree1bc659f486af707673c36916c4d75ef7f517dece /infback.c
parent518ad0177ae2f1aaefc49285b3536a6bd8d9973c (diff)
downloadzlib-f442c1e89e99ae5a0068a2d32e7284c2623f09fd.tar.gz
Add a ./config --solo option to make zlib subset with no libary use
A common request has been the ability to compile zlib to require no other libraries. This --solo option provides that ability. The price is that the gz*, compress*, and uncompress functions are eliminated, and that the user must provide memory allocation and free routines to deflate and inflate when initializing.
Diffstat (limited to 'infback.c')
-rw-r--r--infback.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/infback.c b/infback.c
index af3a8c9..5462952 100644
--- a/infback.c
+++ b/infback.c
@@ -42,10 +42,19 @@ int stream_size;
return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
+#endif
}
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
+ if (strm->zfree == (free_func)0)
+#ifdef Z_SOLO
+ return Z_STREAM_ERROR;
+#else
+ strm->zfree = zcfree;
+#endif
state = (struct inflate_state FAR *)ZALLOC(strm, 1,
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;