aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_buffers.c
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2017-04-18 01:12:01 +0200
committerAlexander Færøy <ahf@torproject.org>2017-04-18 01:12:01 +0200
commit40ed68290e69d32d95bc0d0c259d8c76ae3e80ef (patch)
treea75dfb4a4afa21b40bd544b63d324255710b7364 /src/test/test_buffers.c
parent4b9349192d4bd2e9c598b13d74bc826c8f16d40e (diff)
downloadtor-40ed68290e69d32d95bc0d0c259d8c76ae3e80ef.tar.gz
tor-40ed68290e69d32d95bc0d0c259d8c76ae3e80ef.zip
Rename `zlib_state` to `compress_state` in the test_buffers.
See https://bugs.torproject.org/21663
Diffstat (limited to 'src/test/test_buffers.c')
-rw-r--r--src/test/test_buffers.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/test/test_buffers.c b/src/test/test_buffers.c
index a6f0309427..be757ae628 100644
--- a/src/test/test_buffers.c
+++ b/src/test/test_buffers.c
@@ -584,22 +584,23 @@ test_buffers_zlib_impl(int finalize_with_nil)
char *contents = NULL;
char *expanded = NULL;
buf_t *buf = NULL;
- tor_compress_state_t *zlib_state = NULL;
+ tor_compress_state_t *compress_state = NULL;
size_t out_len, in_len;
int done;
buf = buf_new_with_capacity(128); /* will round up */
- zlib_state = tor_compress_new(1, ZLIB_METHOD, HIGH_COMPRESSION);
+ compress_state = tor_compress_new(1, ZLIB_METHOD, HIGH_COMPRESSION);
msg = tor_malloc(512);
crypto_rand(msg, 512);
- tt_int_op(write_to_buf_zlib(buf, zlib_state, msg, 128, 0), OP_EQ, 0);
- tt_int_op(write_to_buf_zlib(buf, zlib_state, msg+128, 128, 0), OP_EQ, 0);
- tt_int_op(write_to_buf_zlib(buf, zlib_state, msg+256, 256, 0), OP_EQ, 0);
+ tt_int_op(write_to_buf_zlib(buf, compress_state, msg, 128, 0), OP_EQ, 0);
+ tt_int_op(write_to_buf_zlib(buf, compress_state, msg+128, 128, 0), OP_EQ, 0);
+ tt_int_op(write_to_buf_zlib(buf, compress_state, msg+256, 256, 0), OP_EQ, 0);
done = !finalize_with_nil;
- tt_int_op(write_to_buf_zlib(buf, zlib_state, "all done", 9, done), OP_EQ, 0);
+ tt_int_op(write_to_buf_zlib(buf, compress_state,
+ "all done", 9, done), OP_EQ, 0);
if (finalize_with_nil) {
- tt_int_op(write_to_buf_zlib(buf, zlib_state, "", 0, 1), OP_EQ, 0);
+ tt_int_op(write_to_buf_zlib(buf, compress_state, "", 0, 1), OP_EQ, 0);
}
in_len = buf_datalen(buf);
@@ -621,7 +622,7 @@ test_buffers_zlib_impl(int finalize_with_nil)
done:
buf_free(buf);
- tor_compress_free(zlib_state);
+ tor_compress_free(compress_state);
tor_free(contents);
tor_free(expanded);
tor_free(msg);
@@ -647,7 +648,7 @@ test_buffers_zlib_fin_at_chunk_end(void *arg)
char *contents = NULL;
char *expanded = NULL;
buf_t *buf = NULL;
- tor_compress_state_t *zlib_state = NULL;
+ tor_compress_state_t *compress_state = NULL;
size_t out_len, in_len;
size_t sz, headerjunk;
(void) arg;
@@ -666,8 +667,8 @@ test_buffers_zlib_fin_at_chunk_end(void *arg)
tt_uint_op(buf->head->datalen, OP_EQ, headerjunk);
tt_uint_op(buf_datalen(buf), OP_EQ, headerjunk);
/* Write an empty string, with finalization on. */
- zlib_state = tor_compress_new(1, ZLIB_METHOD, HIGH_COMPRESSION);
- tt_int_op(write_to_buf_zlib(buf, zlib_state, "", 0, 1), OP_EQ, 0);
+ compress_state = tor_compress_new(1, ZLIB_METHOD, HIGH_COMPRESSION);
+ tt_int_op(write_to_buf_zlib(buf, compress_state, "", 0, 1), OP_EQ, 0);
in_len = buf_datalen(buf);
contents = tor_malloc(in_len);
@@ -687,7 +688,7 @@ test_buffers_zlib_fin_at_chunk_end(void *arg)
done:
buf_free(buf);
- tor_compress_free(zlib_state);
+ tor_compress_free(compress_state);
tor_free(contents);
tor_free(expanded);
tor_free(msg);