[tor-commits] [tor/master] Remove unused old_state var in connection_or.c

nickm at torproject.org nickm at torproject.org
Fri Dec 21 19:28:10 UTC 2018


commit 308dde0c386158971a66c6e035b3f1ad67019eb5
Author: Taylor Yu <catalyst at torproject.org>
Date:   Thu Dec 13 17:18:49 2018 -0600

    Remove unused old_state var in connection_or.c
    
    connection_or_change_state() saved an old_state to pass to
    channel_tls_handle_state_change_on_orconn(), which promptly cast it to
    void.  Remove this unused variable and parameter.
---
 src/core/or/channeltls.c    | 3 ---
 src/core/or/channeltls.h    | 1 -
 src/core/or/connection_or.c | 6 +-----
 3 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/core/or/channeltls.c b/src/core/or/channeltls.c
index 8f407d5e1..cf33feec0 100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@ -950,7 +950,6 @@ channel_tls_listener_describe_transport_method(channel_listener_t *chan_l)
 void
 channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
                                           or_connection_t *conn,
-                                          uint8_t old_state,
                                           uint8_t state)
 {
   channel_t *base_chan;
@@ -959,8 +958,6 @@ channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
   tor_assert(conn);
   tor_assert(conn->chan == chan);
   tor_assert(chan->conn == conn);
-  /* Shut the compiler up without triggering -Wtautological-compare */
-  (void)old_state;
 
   base_chan = TLS_CHAN_TO_BASE(chan);
 
diff --git a/src/core/or/channeltls.h b/src/core/or/channeltls.h
index 12715450b..2ec7fe545 100644
--- a/src/core/or/channeltls.h
+++ b/src/core/or/channeltls.h
@@ -49,7 +49,6 @@ channel_tls_t * channel_tls_from_base(channel_t *chan);
 void channel_tls_handle_cell(cell_t *cell, or_connection_t *conn);
 void channel_tls_handle_state_change_on_orconn(channel_tls_t *chan,
                                                or_connection_t *conn,
-                                               uint8_t old_state,
                                                uint8_t state);
 void channel_tls_handle_var_cell(var_cell_t *var_cell,
                                  or_connection_t *conn);
diff --git a/src/core/or/connection_or.c b/src/core/or/connection_or.c
index 962ec51c3..04ab4fe4a 100644
--- a/src/core/or/connection_or.c
+++ b/src/core/or/connection_or.c
@@ -408,16 +408,12 @@ connection_or_report_broken_states(int severity, int domain)
 static void
 connection_or_change_state(or_connection_t *conn, uint8_t state)
 {
-  uint8_t old_state;
-
   tor_assert(conn);
 
-  old_state = conn->base_.state;
   conn->base_.state = state;
 
   if (conn->chan)
-    channel_tls_handle_state_change_on_orconn(conn->chan, conn,
-                                              old_state, state);
+    channel_tls_handle_state_change_on_orconn(conn->chan, conn, state);
 }
 
 /** Return the number of circuits using an or_connection_t; this used to





More information about the tor-commits mailing list