aboutsummaryrefslogtreecommitdiff
path: root/src/core/or
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-07-16 10:26:43 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-07-16 12:55:06 -0400
commit7ebfa607b238ed909473bb971d1187066d68c56f (patch)
treee94ab2e53a0c19164f60e43fc53bee7e85195ab0 /src/core/or
parentb3eb4091579e59e4bf311713a3bef0f85137b1b0 (diff)
downloadtor-7ebfa607b238ed909473bb971d1187066d68c56f.tar.gz
tor-7ebfa607b238ed909473bb971d1187066d68c56f.zip
Use CONST_TO_* macros in more places.
This is an automated commit made with a python script. After running the automated script, I had to hand-revert the cases where it made the conversion functions call themselves. Additionally, I had to edit a variable declaration in control_bootstrap.c so that the result of a const cast could be put in a const field.
Diffstat (limited to 'src/core/or')
-rw-r--r--src/core/or/channeltls.c4
-rw-r--r--src/core/or/scheduler.c2
-rw-r--r--src/core/or/scheduler_kist.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 4a421462cc..90049a7e5c 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -538,7 +538,7 @@ static int
channel_tls_get_remote_addr_method(const channel_t *chan,
tor_addr_t *addr_out)
{
- const channel_tls_t *tlschan = BASE_CHAN_TO_TLS((channel_t*) chan);
+ const channel_tls_t *tlschan = CONST_BASE_CHAN_TO_TLS(chan);
tor_assert(tlschan);
tor_assert(addr_out);
@@ -593,7 +593,7 @@ channel_tls_get_transport_name_method(channel_t *chan, char **transport_out)
static const char *
channel_tls_describe_peer_method(const channel_t *chan)
{
- const channel_tls_t *tlschan = BASE_CHAN_TO_TLS((channel_t*)chan);
+ const channel_tls_t *tlschan = CONST_BASE_CHAN_TO_TLS(chan);
tor_assert(tlschan);
if (tlschan->conn) {
diff --git a/src/core/or/scheduler.c b/src/core/or/scheduler.c
index 072d78128b..18f11487d9 100644
--- a/src/core/or/scheduler.c
+++ b/src/core/or/scheduler.c
@@ -713,7 +713,7 @@ scheduler_bug_occurred(const channel_t *chan)
if (chan != NULL) {
const size_t outbuf_len =
- buf_datalen(TO_CONN(BASE_CHAN_TO_TLS((channel_t *) chan)->conn)->outbuf);
+ buf_datalen(TO_CONN(CONST_BASE_CHAN_TO_TLS(chan)->conn)->outbuf);
tor_snprintf(buf, sizeof(buf),
"Channel %" PRIu64 " in state %s and scheduler state %s."
" Num cells on cmux: %d. Connection outbuf len: %lu.",
diff --git a/src/core/or/scheduler_kist.c b/src/core/or/scheduler_kist.c
index 5c1922847e..8c6a7bd1d1 100644
--- a/src/core/or/scheduler_kist.c
+++ b/src/core/or/scheduler_kist.c
@@ -203,7 +203,7 @@ update_socket_info_impl, (socket_table_ent_t *ent))
tor_assert(ent);
tor_assert(ent->chan);
const tor_socket_t sock =
- TO_CONN(BASE_CHAN_TO_TLS((channel_t *) ent->chan)->conn)->s;
+ TO_CONN(CONST_BASE_CHAN_TO_TLS(ent->chan)->conn)->s;
struct tcp_info tcp;
socklen_t tcp_info_len = sizeof(tcp);