BUILD: remove dependency to zlib.h
The build was dependent of the zlib.h header, regardless of the USE_ZLIB option. The fix consists of several #ifdef in the source code. It removes the overhead of the zstream structure in the session when you don't use the option.
This commit is contained in:
parent
1c2d622d82
commit
08289f12f9
|
@ -23,8 +23,12 @@
|
|||
#ifndef _TYPES_COMP_H
|
||||
#define _TYPES_COMP_H
|
||||
|
||||
#ifdef USE_ZLIB
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
#endif /* USE_ZLIB */
|
||||
|
||||
struct comp {
|
||||
struct comp_algo *algos;
|
||||
struct comp_type *types;
|
||||
|
@ -32,7 +36,9 @@ struct comp {
|
|||
};
|
||||
|
||||
struct comp_ctx {
|
||||
#ifdef USE_ZLIB
|
||||
z_stream strm; /* zlib stream */
|
||||
#endif /* USE_ZLIB */
|
||||
};
|
||||
|
||||
struct comp_algo {
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <types/channel.h>
|
||||
#include <types/compression.h>
|
||||
|
||||
#include <types/proto_http.h>
|
||||
#include <types/proxy.h>
|
||||
#include <types/queue.h>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef USE_ZLIB
|
||||
/* Note: the crappy zlib and openssl libs both define the "free_func" type.
|
||||
* That's a very clever idea to use such a generic name in general purpose
|
||||
* libraries, really... The zlib one is easier to redefine than openssl's,
|
||||
|
@ -21,6 +22,7 @@
|
|||
#define free_func zlib_free_func
|
||||
#include <zlib.h>
|
||||
#undef free_func
|
||||
#endif /* USE_ZLIB */
|
||||
|
||||
#include <common/compat.h>
|
||||
|
||||
|
@ -200,6 +202,8 @@ int http_compression_buffer_end(struct session *s, struct buffer **in, struct bu
|
|||
int left;
|
||||
struct http_msg *msg = &s->txn.rsp;
|
||||
struct buffer *ib = *in, *ob = *out;
|
||||
|
||||
#ifdef USE_ZLIB
|
||||
int ret;
|
||||
|
||||
/* flush data here */
|
||||
|
@ -212,6 +216,8 @@ int http_compression_buffer_end(struct session *s, struct buffer **in, struct bu
|
|||
if (ret < 0)
|
||||
return -1; /* flush failed */
|
||||
|
||||
#endif /* USE_ZLIB */
|
||||
|
||||
if (ob->i > 8) {
|
||||
/* more than a chunk size => some data were emitted */
|
||||
char *tail = ob->p + ob->i;
|
||||
|
|
Loading…
Reference in New Issue