]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
don't assert multiple things in the same tor_assert()
authorRoger Dingledine <arma@torproject.org>
Sat, 16 Oct 2004 22:14:52 +0000 (22:14 +0000)
committerRoger Dingledine <arma@torproject.org>
Sat, 16 Oct 2004 22:14:52 +0000 (22:14 +0000)
svn:r2544

17 files changed:
src/or/buffers.c
src/or/circuitbuild.c
src/or/circuituse.c
src/or/config.c
src/or/connection.c
src/or/connection_or.c
src/or/cpuworker.c
src/or/directory.c
src/or/dns.c
src/or/main.c
src/or/or.h
src/or/relay.c
src/or/rendclient.c
src/or/rendservice.c
src/or/router.c
src/or/routerparse.c
src/or/test.c

index 26c1e568ab6899cf53d558fa48a15d762f9d48b0..350d922f749b58e2f84e0961807e13f53dd628e5 100644 (file)
@@ -167,7 +167,8 @@ int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof) {
   int read_result;
 
   assert_buf_ok(buf);
-  tor_assert(reached_eof && (s>=0));
+  tor_assert(reached_eof);
+  tor_assert(s>=0);
 
   if (buf_ensure_capacity(buf,buf->datalen+at_most))
     return -1;
@@ -242,7 +243,9 @@ int flush_buf(int s, buf_t *buf, size_t *buf_flushlen)
   int write_result;
 
   assert_buf_ok(buf);
-  tor_assert(buf_flushlen && (s>=0) && (*buf_flushlen <= buf->datalen));
+  tor_assert(buf_flushlen);
+  tor_assert(s>=0);
+  tor_assert(*buf_flushlen <= buf->datalen);
 
   if(*buf_flushlen == 0) /* nothing to flush */
     return 0;
@@ -270,7 +273,8 @@ int flush_buf_tls(tor_tls *tls, buf_t *buf, size_t *buf_flushlen)
 {
   int r;
   assert_buf_ok(buf);
-  tor_assert(tls && buf_flushlen);
+  tor_assert(tls);
+  tor_assert(buf_flushlen);
 
   /* we want to let tls write even if flushlen is zero, because it might
    * have a partial record pending */
index a98821cca4b892eabdfe593349010889bbe8ec26..c5d16d270d02adec623e7972b963a40dcb69341f 100644 (file)
@@ -40,7 +40,8 @@ static uint16_t get_unique_circ_id_by_conn(connection_t *conn, int circ_id_type)
   int attempts=0;
   uint16_t high_bit;
 
-  tor_assert(conn && conn->type == CONN_TYPE_OR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_OR);
   high_bit = (circ_id_type == CIRC_ID_TYPE_HIGHER) ? 1<<15 : 0;
   do {
     /* Sequentially iterate over test_circ_id=1...1<<15-1 until we find a
@@ -72,7 +73,8 @@ void circuit_log_path(int severity, circuit_t *circ) {
   struct crypt_path_t *hop;
   char *states[] = {"closed", "waiting for keys", "open"};
   routerinfo_t *router;
-  tor_assert(CIRCUIT_IS_ORIGIN(circ) && circ->cpath);
+  tor_assert(CIRCUIT_IS_ORIGIN(circ));
+  tor_assert(circ->cpath);
 
   snprintf(s, sizeof(buf)-1, "circ (length %d, exit %s): ",
           circ->build_state->desired_path_len, circ->build_state->chosen_exit_name);
@@ -307,7 +309,9 @@ circuit_deliver_create_cell(circuit_t *circ, char *payload) {
   int circ_id_type;
   cell_t cell;
 
-  tor_assert(circ && circ->n_conn && circ->n_conn->type == CONN_TYPE_OR);
+  tor_assert(circ);
+  tor_assert(circ->n_conn);
+  tor_assert(circ->n_conn->type == CONN_TYPE_OR);
   tor_assert(payload);
 
   /* XXXX008 How can we keep a good upgrade path here?  We should
@@ -352,7 +356,8 @@ int circuit_send_next_onion_skin(circuit_t *circ) {
   char *onionskin;
   size_t payload_len;
 
-  tor_assert(circ && CIRCUIT_IS_ORIGIN(circ));
+  tor_assert(circ);
+  tor_assert(CIRCUIT_IS_ORIGIN(circ));
 
   if(circ->cpath->state == CPATH_STATE_CLOSED) {
     log_fn(LOG_DEBUG,"First skin; sending create cell.");
@@ -543,7 +548,8 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse)
   crypto_digest_env_t *tmp_digest;
   crypto_cipher_env_t *tmp_crypto;
 
-  tor_assert(cpath && key_data);
+  tor_assert(cpath);
+  tor_assert(key_data);
   tor_assert(!(cpath->f_crypto || cpath->b_crypto ||
              cpath->f_digest || cpath->b_digest));
 
@@ -636,7 +642,8 @@ int circuit_truncated(circuit_t *circ, crypt_path_t *layer) {
 //  crypt_path_t *victim;
 //  connection_t *stream;
 
-  tor_assert(circ && CIRCUIT_IS_ORIGIN(circ));
+  tor_assert(circ);
+  tor_assert(CIRCUIT_IS_ORIGIN(circ));
   tor_assert(layer);
 
   /* XXX Since we don't ask for truncates currently, getting a truncated
@@ -743,7 +750,9 @@ static int new_route_len(double cw, uint8_t purpose, smartlist_t *routers) {
   int num_acceptable_routers;
   int routelen;
 
-  tor_assert((cw >= 0) && (cw < 1) && routers); /* valid parameters */
+  tor_assert(cw >= 0.);
+  tor_assert(cw < 1.);
+  tor_assert(routers);
 
 #ifdef TOR_PERF
   routelen = 2;
index 057a2a85a53bec80dbe2214871b5e0fc4db84184..9ce848038fc3f73102c392b1e0a5cda053e3fcca 100644 (file)
@@ -331,7 +331,8 @@ void circuit_build_needed_circs(time_t now) {
 void circuit_detach_stream(circuit_t *circ, connection_t *conn) {
   connection_t *prevconn;
 
-  tor_assert(circ && conn);
+  tor_assert(circ);
+  tor_assert(conn);
 
   conn->cpath_layer = NULL; /* make sure we don't keep a stale pointer */
 
@@ -738,7 +739,9 @@ static void link_apconn_to_circ(connection_t *apconn, circuit_t *circ) {
   /* assert_connection_ok(conn, time(NULL)); */
   circ->p_streams = apconn;
 
-  tor_assert(CIRCUIT_IS_ORIGIN(circ) && circ->cpath && circ->cpath->prev);
+  tor_assert(CIRCUIT_IS_ORIGIN(circ));
+  tor_assert(circ->cpath);
+  tor_assert(circ->cpath->prev);
   tor_assert(circ->cpath->prev->state == CPATH_STATE_OPEN);
   apconn->cpath_layer = circ->cpath->prev;
 }
index dea2b6252729d9a50c55603a338be4dec6f8deda..7d36ddc059d2b16a54b0fe3026d2d02fd5b8208c 100644 (file)
@@ -277,7 +277,7 @@ config_assign(or_options_t *options, struct config_line_t *list)
       config_compare(list, "PidFile",        CONFIG_TYPE_STRING, &options->PidFile) ||
       config_compare(list, "PathlenCoinWeight",CONFIG_TYPE_DOUBLE, &options->PathlenCoinWeight) ||
 
-      config_compare(list, "RouterFile",     CONFIG_TYPE_STRING, &options->RouterFile) ||
+      config_compare(list, "RouterFile",     CONFIG_TYPE_OBSOLETE, NULL) ||
       config_compare(list, "RunAsDaemon",    CONFIG_TYPE_BOOL, &options->RunAsDaemon) ||
       config_compare(list, "RunTesting",     CONFIG_TYPE_BOOL, &options->RunTesting) ||
       config_compare(list, "RecommendedVersions",CONFIG_TYPE_LINELIST, &options->RecommendedVersions) ||
@@ -457,7 +457,6 @@ free_options(or_options_t *options)
   tor_free(options->ContactInfo);
   tor_free(options->DebugLogFile);
   tor_free(options->DataDirectory);
-  tor_free(options->RouterFile);
   tor_free(options->Nickname);
   tor_free(options->Address);
   tor_free(options->PidFile);
index 08bae131f5a9abe2f9b9873a580b5b7b25c5041b..477353b5f45b2ad04f099f63901fd07132db5679 100644 (file)
@@ -1331,31 +1331,31 @@ void assert_connection_ok(connection_t *conn, time_t now)
       tor_assert(conn->state == LISTENER_STATE_READY);
       break;
     case CONN_TYPE_OR:
-      tor_assert(conn->state >= _OR_CONN_STATE_MIN &&
-                 conn->state <= _OR_CONN_STATE_MAX);
+      tor_assert(conn->state >= _OR_CONN_STATE_MIN);
+      tor_assert(conn->state <= _OR_CONN_STATE_MAX);
       break;
     case CONN_TYPE_EXIT:
-      tor_assert(conn->state >= _EXIT_CONN_STATE_MIN &&
-                 conn->state <= _EXIT_CONN_STATE_MAX);
+      tor_assert(conn->state >= _EXIT_CONN_STATE_MIN);
+      tor_assert(conn->state <= _EXIT_CONN_STATE_MAX);
       break;
     case CONN_TYPE_AP:
-      tor_assert(conn->state >= _AP_CONN_STATE_MIN &&
-                 conn->state <= _AP_CONN_STATE_MAX);
+      tor_assert(conn->state >= _AP_CONN_STATE_MIN);
+      tor_assert(conn->state <= _AP_CONN_STATE_MAX);
       tor_assert(conn->socks_request);
       break;
     case CONN_TYPE_DIR:
-      tor_assert(conn->state >= _DIR_CONN_STATE_MIN &&
-                 conn->state <= _DIR_CONN_STATE_MAX);
-      tor_assert(conn->purpose >= _DIR_PURPOSE_MIN &&
-                 conn->purpose <= _DIR_PURPOSE_MAX);
+      tor_assert(conn->state >= _DIR_CONN_STATE_MIN);
+      tor_assert(conn->state <= _DIR_CONN_STATE_MAX);
+      tor_assert(conn->purpose >= _DIR_PURPOSE_MIN);
+      tor_assert(conn->purpose <= _DIR_PURPOSE_MAX);
       break;
     case CONN_TYPE_DNSWORKER:
       tor_assert(conn->state == DNSWORKER_STATE_IDLE ||
                  conn->state == DNSWORKER_STATE_BUSY);
       break;
     case CONN_TYPE_CPUWORKER:
-      tor_assert(conn->state >= _CPUWORKER_STATE_MIN &&
-                 conn->state <= _CPUWORKER_STATE_MAX);
+      tor_assert(conn->state >= _CPUWORKER_STATE_MIN);
+      tor_assert(conn->state <= _CPUWORKER_STATE_MAX);
       break;
     default:
       tor_assert(0);
index ccbb3f54cb9f9f890f2975d0de4b1bc35b5fecba..7ad0230d4aa45853aa86926e04c34cbb2d451f48 100644 (file)
@@ -43,7 +43,8 @@ static void cell_unpack(cell_t *dest, const char *src) {
  */
 int connection_or_process_inbuf(connection_t *conn) {
 
-  tor_assert(conn && conn->type == CONN_TYPE_OR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_OR);
 
   if(conn->inbuf_reached_eof) {
     log_fn(LOG_INFO,"OR connection reached EOF. Closing.");
@@ -65,7 +66,8 @@ int connection_or_process_inbuf(connection_t *conn) {
  * return 0.
  */
 int connection_or_finished_flushing(connection_t *conn) {
-  tor_assert(conn && conn->type == CONN_TYPE_OR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_OR);
 
   assert_connection_ok(conn,0);
 
@@ -82,7 +84,8 @@ int connection_or_finished_flushing(connection_t *conn) {
  */
 int connection_or_finished_connecting(connection_t *conn)
 {
-  tor_assert(conn && conn->type == CONN_TYPE_OR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_OR);
   tor_assert(conn->state == OR_CONN_STATE_CONNECTING);
 
   log_fn(LOG_INFO,"OR connect() to router %s:%u finished.",
@@ -152,6 +155,7 @@ connection_or_update_nickname(connection_t *conn)
   routerinfo_t *r;
   const char *n;
 
+  tor_assert(conn);
   tor_assert(conn->type == CONN_TYPE_OR);
   n = dirserv_get_nickname_by_digest(conn->identity_digest);
   if (n) {
@@ -414,7 +418,8 @@ void connection_or_write_cell_to_buf(const cell_t *cell, connection_t *conn) {
   char networkcell[CELL_NETWORK_SIZE];
   char *n = networkcell;
 
-  tor_assert(cell && conn);
+  tor_assert(cell);
+  tor_assert(conn);
   tor_assert(connection_speaks_cells(conn));
 
   cell_pack(n, cell);
index 6abcab5d9ac37fa107928b7ee222eac8e11f8754..1d6eee4bd952908198547742dff9a91ade378199 100644 (file)
@@ -48,7 +48,8 @@ void cpu_init(void) {
 
 /** Called when we're done sending a request to a cpuworker. */
 int connection_cpu_finished_flushing(connection_t *conn) {
-  tor_assert(conn && conn->type == CONN_TYPE_CPUWORKER);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_CPUWORKER);
   connection_stop_writing(conn);
   return 0;
 }
@@ -104,7 +105,8 @@ int connection_cpu_process_inbuf(connection_t *conn) {
   connection_t *p_conn;
   circuit_t *circ;
 
-  tor_assert(conn && conn->type == CONN_TYPE_CPUWORKER);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_CPUWORKER);
 
   if(conn->inbuf_reached_eof) {
     log_fn(LOG_WARN,"Read eof. Worker died unexpectedly.");
index 0f4b4a00d7010055482c6bd42aa1f5431b14cd53..5a5ff282abf6bb696271306449c3ef19eb72e8cf 100644 (file)
@@ -169,7 +169,10 @@ directory_initiate_command(const char *address, uint32_t addr,
 {
   connection_t *conn;
 
-  tor_assert(address && addr && dir_port && digest);
+  tor_assert(address);
+  tor_assert(addr);
+  tor_assert(dir_port);
+  tor_assert(digest);
 
   switch (purpose) {
     case DIR_PURPOSE_FETCH_DIR:
@@ -272,8 +275,9 @@ directory_send_command(connection_t *conn, const char *platform,
   int use_newer = 0;
   char *httpcommand = NULL;
 
-  tor_assert(conn && conn->type == CONN_TYPE_DIR);
-  tor_assert(dir_port && conn);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DIR);
+  tor_assert(dir_port);
 
   /* If we don't know the platform, assume it's up-to-date. */
   use_newer = platform ? tor_version_as_new_as(platform, "0.0.9pre1"):1;
@@ -410,7 +414,8 @@ parse_http_response(char *headers, int *code, char **message, time_t *date,
   int n1, n2;
   char datestr[RFC1123_TIME_LEN+1];
   smartlist_t *parsed_headers;
-  tor_assert(headers && code);
+  tor_assert(headers);
+  tor_assert(code);
 
   while(isspace((int)*headers)) headers++; /* tolerate leading whitespace */
 
@@ -631,7 +636,8 @@ connection_dir_client_reached_eof(connection_t *conn)
 int connection_dir_process_inbuf(connection_t *conn) {
   int retval;
 
-  tor_assert(conn && conn->type == CONN_TYPE_DIR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DIR);
 
   /* Directory clients write, then read data until they receive EOF;
    * directory servers read data until they get an HTTP command, then
@@ -859,7 +865,8 @@ static int directory_handle_command(connection_t *conn) {
   size_t body_len=0;
   int r;
 
-  tor_assert(conn && conn->type == CONN_TYPE_DIR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DIR);
 
   switch(fetch_from_buf_http(conn->inbuf,
                              &headers, MAX_HEADERS_SIZE,
@@ -894,7 +901,8 @@ static int directory_handle_command(connection_t *conn) {
  */
 int connection_dir_finished_flushing(connection_t *conn) {
 
-  tor_assert(conn && conn->type == CONN_TYPE_DIR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DIR);
 
   switch(conn->state) {
     case DIR_CONN_STATE_CLIENT_SENDING:
@@ -917,7 +925,8 @@ int connection_dir_finished_flushing(connection_t *conn) {
  * server */
 int connection_dir_finished_connecting(connection_t *conn)
 {
-  tor_assert(conn && conn->type == CONN_TYPE_DIR);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DIR);
   tor_assert(conn->state == DIR_CONN_STATE_CONNECTING);
 
   log_fn(LOG_INFO,"Dir connection to router %s:%u established.",
index 56f7378982ffc435529c936c8d09c0df87b5b0ea..17bb58c594ca26652289babde08d8c91af21fcde 100644 (file)
@@ -547,7 +547,8 @@ static void dns_found_answer(char *address, uint32_t addr, char outcome) {
 
 /** Write handler: called when we've pushed a request to a dnsworker. */
 int connection_dns_finished_flushing(connection_t *conn) {
-  tor_assert(conn && conn->type == CONN_TYPE_DNSWORKER);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DNSWORKER);
   connection_stop_writing(conn);
   return 0;
 }
@@ -560,7 +561,8 @@ int connection_dns_process_inbuf(connection_t *conn) {
   char success;
   uint32_t addr;
 
-  tor_assert(conn && conn->type == CONN_TYPE_DNSWORKER);
+  tor_assert(conn);
+  tor_assert(conn->type == CONN_TYPE_DNSWORKER);
 
   if(conn->inbuf_reached_eof) {
     log_fn(LOG_WARN,"Read eof. Worker died unexpectedly.");
index 13c53d60b64cd0db6d583ffdb0c0a15eb8872d6a..8c3e3e36ae41719c34cc12de403ae1ec7e0fa5a3 100644 (file)
@@ -170,20 +170,25 @@ void get_connection_array(connection_t ***array, int *n) {
  */
 void connection_watch_events(connection_t *conn, short events) {
 
-  tor_assert(conn && conn->poll_index >= 0 && conn->poll_index < nfds);
+  tor_assert(conn);
+  tor_assert(conn->poll_index >= 0);
+  tor_assert(conn->poll_index < nfds);
 
   poll_array[conn->poll_index].events = events;
 }
 
 /** Return true iff <b>conn</b> is listening for read events. */
 int connection_is_reading(connection_t *conn) {
-  tor_assert(conn && conn->poll_index >= 0);
+  tor_assert(conn);
+  tor_assert(conn->poll_index >= 0);
   return poll_array[conn->poll_index].events & POLLIN;
 }
 
 /** Tell the main loop to stop notifying <b>conn</b> of any read events. */
 void connection_stop_reading(connection_t *conn) {
-  tor_assert(conn && conn->poll_index >= 0 && conn->poll_index < nfds);
+  tor_assert(conn);
+  tor_assert(conn->poll_index >= 0);
+  tor_assert(conn->poll_index < nfds);
 
   log(LOG_DEBUG,"connection_stop_reading() called.");
   if(poll_array[conn->poll_index].events & POLLIN)
@@ -192,7 +197,9 @@ void connection_stop_reading(connection_t *conn) {
 
 /** Tell the main loop to start notifying <b>conn</b> of any read events. */
 void connection_start_reading(connection_t *conn) {
-  tor_assert(conn && conn->poll_index >= 0 && conn->poll_index < nfds);
+  tor_assert(conn);
+  tor_assert(conn->poll_index >= 0);
+  tor_assert(conn->poll_index < nfds);
   poll_array[conn->poll_index].events |= POLLIN;
 }
 
@@ -203,14 +210,18 @@ int connection_is_writing(connection_t *conn) {
 
 /** Tell the main loop to stop notifying <b>conn</b> of any write events. */
 void connection_stop_writing(connection_t *conn) {
-  tor_assert(conn && conn->poll_index >= 0 && conn->poll_index < nfds);
+  tor_assert(conn);
+  tor_assert(conn->poll_index >= 0);
+  tor_assert(conn->poll_index < nfds);
   if(poll_array[conn->poll_index].events & POLLOUT)
     poll_array[conn->poll_index].events -= POLLOUT;
 }
 
 /** Tell the main loop to start notifying <b>conn</b> of any write events. */
 void connection_start_writing(connection_t *conn) {
-  tor_assert(conn && conn->poll_index >= 0 && conn->poll_index < nfds);
+  tor_assert(conn);
+  tor_assert(conn->poll_index >= 0);
+  tor_assert(conn->poll_index < nfds);
   poll_array[conn->poll_index].events |= POLLOUT;
 }
 
index c90c275eeda255cead4276a3e9ab32d895928b1d..da321a44c03138b13470b079d4e4ebec4b882b09 100644 (file)
@@ -825,7 +825,6 @@ typedef struct {
 
   char *DebugLogFile; /**< Where to send verbose log messages. */
   char *DataDirectory; /**< OR only: where to store long-term data. */
-  char *RouterFile; /**< Where to find starting list of ORs. */
   char *Nickname; /**< OR only: nickname of this onion router. */
   char *Address; /**< OR only: configured address for this onion router. */
   char *PidFile; /**< Where to store PID of Tor process. */
index 3c353b71d4bc0e262f147571a05e1314ce794dab..f00d76525a2a733071ef7cec302b1959e52121f7 100644 (file)
@@ -139,8 +139,10 @@ int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
   crypt_path_t *layer_hint=NULL;
   char recognized=0;
 
-  tor_assert(cell && circ);
-  tor_assert(cell_direction == CELL_DIRECTION_OUT || cell_direction == CELL_DIRECTION_IN);
+  tor_assert(cell);
+  tor_assert(circ);
+  tor_assert(cell_direction == CELL_DIRECTION_OUT ||
+             cell_direction == CELL_DIRECTION_IN);
   if (circ->marked_for_close)
     return 0;
 
@@ -224,8 +226,11 @@ static int relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
   crypt_path_t *thishop;
   relay_header_t rh;
 
-  tor_assert(circ && cell && recognized);
-  tor_assert(cell_direction == CELL_DIRECTION_IN || cell_direction == CELL_DIRECTION_OUT);
+  tor_assert(circ);
+  tor_assert(cell);
+  tor_assert(recognized);
+  tor_assert(cell_direction == CELL_DIRECTION_IN ||
+             cell_direction == CELL_DIRECTION_OUT);
 
   if(cell_direction == CELL_DIRECTION_IN) {
     if(CIRCUIT_IS_ORIGIN(circ)) { /* We're at the beginning of the circuit.
@@ -642,7 +647,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
   static int num_seen=0;
   relay_header_t rh;
 
-  tor_assert(cell && circ);
+  tor_assert(cell);
+  tor_assert(circ);
 
   relay_header_unpack(&rh, cell->payload);
 //  log_fn(LOG_DEBUG,"command %d stream %d", rh.command, rh.stream_id);
index 70f0564a5fdea2529efb8391debd08c0c5280f1f..e6a990bd2b09a27e4bbc855fc4b36c06c40029a6 100644 (file)
@@ -15,7 +15,8 @@ void
 rend_client_introcirc_has_opened(circuit_t *circ)
 {
   tor_assert(circ->purpose == CIRCUIT_PURPOSE_C_INTRODUCING);
-  tor_assert(CIRCUIT_IS_ORIGIN(circ) && circ->cpath);
+  tor_assert(CIRCUIT_IS_ORIGIN(circ));
+  tor_assert(circ->cpath);
 
   log_fn(LOG_INFO,"introcirc is open");
   connection_ap_attach_pending();
@@ -315,7 +316,8 @@ rend_client_receive_rendezvous(circuit_t *circ, const char *request, size_t requ
   }
 
   /* first DH_KEY_LEN bytes are g^y from bob. Finish the dh handshake...*/
-  tor_assert(circ->build_state && circ->build_state->pending_final_cpath);
+  tor_assert(circ->build_state);
+  tor_assert(circ->build_state->pending_final_cpath);
   hop = circ->build_state->pending_final_cpath;
   tor_assert(hop->handshake_state);
   if (crypto_dh_compute_secret(hop->handshake_state, request, DH_KEY_LEN,
index 2c86b4385f1c22e72a94176ef173a7835affd9de..028c2010dc1694b5823e657c84a397cac4e06e70 100644 (file)
@@ -508,7 +508,8 @@ rend_service_relaunch_rendezvous(circuit_t *oldcirc)
   }
   oldstate = oldcirc->build_state;
   newstate = newcirc->build_state;
-  tor_assert(newstate && oldstate);
+  tor_assert(newstate);
+  tor_assert(oldstate);
   newstate->failure_count = oldstate->failure_count+1;
   newstate->pending_final_cpath = oldstate->pending_final_cpath;
   oldstate->pending_final_cpath = NULL;
@@ -556,7 +557,8 @@ rend_service_intro_has_opened(circuit_t *circuit)
   char serviceid[REND_SERVICE_ID_LEN+1];
 
   tor_assert(circuit->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO);
-  tor_assert(CIRCUIT_IS_ORIGIN(circuit) && circuit->cpath);
+  tor_assert(CIRCUIT_IS_ORIGIN(circuit));
+  tor_assert(circuit->cpath);
 
   base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
                 circuit->rend_pk_digest,10);
index 26a4b97f6d600d6b628bf92b7d106a4980737a27..08743abf8d635c1c020259a9d08e8fdabbc11ec3 100644 (file)
@@ -56,7 +56,8 @@ crypto_pk_env_t *get_previous_onion_key(void) {
 
 void dup_onion_keys(crypto_pk_env_t **key, crypto_pk_env_t **last)
 {
-  tor_assert(key && last);
+  tor_assert(key);
+  tor_assert(last);
   tor_mutex_acquire(key_lock);
   *key = crypto_pk_dup_key(onionkey);
   if (lastonionkey)
index 6a759fdd1f63a6ae8aeeb9ed416993291657eb47..8700502a0a661fdb8c949f62b5760a7f21ed9e57 100644 (file)
@@ -388,8 +388,8 @@ router_parse_routerlist_from_directory(const char *str,
     goto err;
   }
   if (tok->n_args > 1) {
-    log_fn(LOG_WARN, "Invalid recommended-software line");goto err;
-           
+    log_fn(LOG_WARN, "Invalid recommended-software line");
+    goto err;
   }
   versions = tok->n_args ? tor_strdup(tok->args[0]) : tor_strdup("");
 
@@ -681,7 +681,8 @@ router_parse_list_from_string(const char **s, routerlist_t **dest,
   smartlist_t *routers;
   const char *end;
 
-  tor_assert(s && *s);
+  tor_assert(s);
+  tor_assert(*s);
 
   routers = smartlist_create();
 
@@ -848,7 +849,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
   }
   tor_assert(tok->n_args == 1);
   if (parse_iso_time(tok->args[0], &router->published_on) < 0)
-          goto err;
+    goto err;
 
   if (!(tok = find_first_by_keyword(tokens, K_ONION_KEY))) {
     log_fn(LOG_WARN, "Missing onion key"); goto err;
@@ -1421,7 +1422,8 @@ int tor_version_parse(const char *s, tor_version_t *out)
   /* Format is:
    *   NUM dot NUM dot NUM [ ( pre | rc | dot ) NUM [ -cvs ] ]
    */
-  tor_assert(s && out);
+  tor_assert(s);
+  tor_assert(out);
   memset(out, 0, sizeof(tor_version_t));
 
   /* Get major. */
@@ -1481,7 +1483,8 @@ int tor_version_parse(const char *s, tor_version_t *out)
 int tor_version_compare(tor_version_t *a, tor_version_t *b)
 {
   int i;
-  tor_assert(a && b);
+  tor_assert(a);
+  tor_assert(b);
   if ((i = a->major - b->major))
     return i;
   else if ((i = a->minor - b->minor))
index f317d674cd27aa4732899177fd08ff05585e9591..7506d5deb19cd9a803b7d07f6d6e7fc9c59d826f 100644 (file)
@@ -34,7 +34,8 @@ dump_hex(char *s, size_t len)
   for(i=0;i<len;++i) {
     for (j=1;j>=0;--j) {
       nyb = (((int) d[i]) >> (j*4)) & 0x0f;
-      tor_assert(0<=nyb && nyb <=15);
+      tor_assert(0 <= nyb);
+      tor_assert(nyb <= 15);
       putchar(TABLE[nyb]);
     }
   }