diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-10-07 01:57:07 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-10-07 02:11:56 -0700 |
commit | f442c1e89e99ae5a0068a2d32e7284c2623f09fd (patch) | |
tree | 1bc659f486af707673c36916c4d75ef7f517dece /infback.c | |
parent | 518ad0177ae2f1aaefc49285b3536a6bd8d9973c (diff) | |
download | zlib-f442c1e89e99ae5a0068a2d32e7284c2623f09fd.tar.gz zlib-f442c1e89e99ae5a0068a2d32e7284c2623f09fd.tar.bz2 zlib-f442c1e89e99ae5a0068a2d32e7284c2623f09fd.zip |
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.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -42,10 +42,19 @@ int stream_size; | |||
42 | return Z_STREAM_ERROR; | 42 | return Z_STREAM_ERROR; |
43 | strm->msg = Z_NULL; /* in case we return an error */ | 43 | strm->msg = Z_NULL; /* in case we return an error */ |
44 | if (strm->zalloc == (alloc_func)0) { | 44 | if (strm->zalloc == (alloc_func)0) { |
45 | #ifdef Z_SOLO | ||
46 | return Z_STREAM_ERROR; | ||
47 | #else | ||
45 | strm->zalloc = zcalloc; | 48 | strm->zalloc = zcalloc; |
46 | strm->opaque = (voidpf)0; | 49 | strm->opaque = (voidpf)0; |
50 | #endif | ||
47 | } | 51 | } |
48 | if (strm->zfree == (free_func)0) strm->zfree = zcfree; | 52 | if (strm->zfree == (free_func)0) |
53 | #ifdef Z_SOLO | ||
54 | return Z_STREAM_ERROR; | ||
55 | #else | ||
56 | strm->zfree = zcfree; | ||
57 | #endif | ||
49 | state = (struct inflate_state FAR *)ZALLOC(strm, 1, | 58 | state = (struct inflate_state FAR *)ZALLOC(strm, 1, |
50 | sizeof(struct inflate_state)); | 59 | sizeof(struct inflate_state)); |
51 | if (state == Z_NULL) return Z_MEM_ERROR; | 60 | if (state == Z_NULL) return Z_MEM_ERROR; |