Rename shadowing variable in compress_zlib.c.

This patch renames the `compress` parameter of the
`tor_zlib_compress_new()` function to `_compress` to avoid shadowing the
`compress()` function in zlib.h.
This commit is contained in:
Alexander Færøy 2017-04-25 14:46:02 +02:00
parent 754b86ba01
commit 91dd4a00f7
No known key found for this signature in database
GPG key ID: E15081D5D3C3DB53

View file

@ -406,14 +406,14 @@ tor_zlib_state_size_precalc(int inflate_, int windowbits, int memlevel)
* <b>method</b>. If <b>compress</b>, it's for compression; otherwise it's for * <b>method</b>. If <b>compress</b>, it's for compression; otherwise it's for
* decompression. */ * decompression. */
tor_zlib_compress_state_t * tor_zlib_compress_state_t *
tor_zlib_compress_new(int compress, tor_zlib_compress_new(int compress_,
compress_method_t method, compress_method_t method,
compression_level_t compression_level) compression_level_t compression_level)
{ {
tor_zlib_compress_state_t *out; tor_zlib_compress_state_t *out;
int bits, memlevel; int bits, memlevel;
if (! compress) { if (! compress_) {
/* use this setting for decompression, since we might have the /* use this setting for decompression, since we might have the
* max number of window bits */ * max number of window bits */
compression_level = HIGH_COMPRESSION; compression_level = HIGH_COMPRESSION;
@ -423,10 +423,10 @@ tor_zlib_compress_new(int compress,
out->stream.zalloc = Z_NULL; out->stream.zalloc = Z_NULL;
out->stream.zfree = Z_NULL; out->stream.zfree = Z_NULL;
out->stream.opaque = NULL; out->stream.opaque = NULL;
out->compress = compress; out->compress = compress_;
bits = method_bits(method, compression_level); bits = method_bits(method, compression_level);
memlevel = memory_level(compression_level); memlevel = memory_level(compression_level);
if (compress) { if (compress_) {
if (deflateInit2(&out->stream, Z_BEST_COMPRESSION, Z_DEFLATED, if (deflateInit2(&out->stream, Z_BEST_COMPRESSION, Z_DEFLATED,
bits, memlevel, bits, memlevel,
Z_DEFAULT_STRATEGY) != Z_OK) Z_DEFAULT_STRATEGY) != Z_OK)
@ -435,7 +435,7 @@ tor_zlib_compress_new(int compress,
if (inflateInit2(&out->stream, bits) != Z_OK) if (inflateInit2(&out->stream, bits) != Z_OK)
goto err; // LCOV_EXCL_LINE goto err; // LCOV_EXCL_LINE
} }
out->allocation = tor_zlib_state_size_precalc(!compress, bits, memlevel); out->allocation = tor_zlib_state_size_precalc(!compress_, bits, memlevel);
total_zlib_allocation += out->allocation; total_zlib_allocation += out->allocation;