Browse Source

CONN_LOG_PROTECT()'s first argument may not be 0

Make that explicit by adding an assert and removing a null-check. All of
its callers currently depend on the argument being non-null anyway.
Silences a few clang complaints.
Sebastian Hahn 14 years ago
parent
commit
8ebb3ce6e2
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/or/or.h

+ 3 - 1
src/or/or.h

@@ -3203,7 +3203,9 @@ typedef enum buildtimeout_set_event_t {
  */
 #define CONN_LOG_PROTECT(conn, stmt)                                    \
   STMT_BEGIN                                                            \
-    int _log_conn_is_control = (conn && conn->type == CONN_TYPE_CONTROL); \
+    int _log_conn_is_control;                                           \
+    tor_assert(conn);                                                   \
+    _log_conn_is_control = (conn->type == CONN_TYPE_CONTROL);           \
     if (_log_conn_is_control)                                           \
       disable_control_logging();                                        \
   STMT_BEGIN stmt; STMT_END;                                            \