[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] don"t assert multiple things in the same tor_assert()



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or

Modified Files:
	buffers.c circuitbuild.c circuituse.c config.c connection.c 
	connection_or.c cpuworker.c directory.c dns.c main.c or.h 
	relay.c rendclient.c rendservice.c router.c routerparse.c 
	test.c 
Log Message:
don't assert multiple things in the same tor_assert()


Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- buffers.c	14 Oct 2004 03:18:14 -0000	1.107
+++ buffers.c	16 Oct 2004 22:14:51 -0000	1.108
@@ -167,7 +167,8 @@
   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 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 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: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- circuitbuild.c	15 Oct 2004 01:58:11 -0000	1.39
+++ circuitbuild.c	16 Oct 2004 22:14:51 -0000	1.40
@@ -40,7 +40,8 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
 //  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 @@
   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: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuituse.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- circuituse.c	11 Oct 2004 22:19:12 -0000	1.16
+++ circuituse.c	16 Oct 2004 22:14:51 -0000	1.17
@@ -331,7 +331,8 @@
 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 @@
   /* 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: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- config.c	16 Oct 2004 21:53:29 -0000	1.175
+++ config.c	16 Oct 2004 22:14:51 -0000	1.176
@@ -277,7 +277,7 @@
       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 @@
   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: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- connection.c	16 Oct 2004 21:57:24 -0000	1.265
+++ connection.c	16 Oct 2004 22:14:51 -0000	1.266
@@ -1331,31 +1331,31 @@
       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: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- connection_or.c	13 Oct 2004 20:05:57 -0000	1.129
+++ connection_or.c	16 Oct 2004 22:14:51 -0000	1.130
@@ -43,7 +43,8 @@
  */
 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 @@
  * 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_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 @@
   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 @@
   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: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cpuworker.c	8 Aug 2004 07:25:45 -0000	1.49
+++ cpuworker.c	16 Oct 2004 22:14:51 -0000	1.50
@@ -48,7 +48,8 @@
 
 /** 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 @@
   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: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- directory.c	15 Oct 2004 20:50:43 -0000	1.149
+++ directory.c	16 Oct 2004 22:14:51 -0000	1.150
@@ -169,7 +169,10 @@
 {
   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 @@
   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 @@
   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 @@
 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 @@
   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 @@
  */
 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 @@
  * 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: dns.c
===================================================================
RCS file: /home/or/cvsroot/src/or/dns.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- dns.c	16 Oct 2004 20:38:56 -0000	1.112
+++ dns.c	16 Oct 2004 22:14:51 -0000	1.113
@@ -547,7 +547,8 @@
 
 /** 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 @@
   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: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -d -r1.334 -r1.335
--- main.c	14 Oct 2004 04:06:24 -0000	1.334
+++ main.c	16 Oct 2004 22:14:51 -0000	1.335
@@ -170,20 +170,25 @@
  */
 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 @@
 
 /** 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 @@
 
 /** 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: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.436
retrieving revision 1.437
diff -u -d -r1.436 -r1.437
--- or.h	15 Oct 2004 20:52:09 -0000	1.436
+++ or.h	16 Oct 2004 22:14:51 -0000	1.437
@@ -825,7 +825,6 @@
 
   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: relay.c
===================================================================
RCS file: /home/or/cvsroot/src/or/relay.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- relay.c	14 Oct 2004 03:18:14 -0000	1.13
+++ relay.c	16 Oct 2004 22:14:51 -0000	1.14
@@ -139,8 +139,10 @@
   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 @@
   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 @@
   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: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- rendclient.c	14 Oct 2004 03:18:14 -0000	1.56
+++ rendclient.c	16 Oct 2004 22:14:52 -0000	1.57
@@ -15,7 +15,8 @@
 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 @@
   }
 
   /* 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: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- rendservice.c	16 Oct 2004 21:53:30 -0000	1.91
+++ rendservice.c	16 Oct 2004 22:14:52 -0000	1.92
@@ -508,7 +508,8 @@
   }
   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 @@
   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: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- router.c	16 Oct 2004 20:38:57 -0000	1.99
+++ router.c	16 Oct 2004 22:14:52 -0000	1.100
@@ -56,7 +56,8 @@
 
 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: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- routerparse.c	16 Oct 2004 21:57:24 -0000	1.60
+++ routerparse.c	16 Oct 2004 22:14:52 -0000	1.61
@@ -388,8 +388,8 @@
     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 @@
   smartlist_t *routers;
   const char *end;
 
-  tor_assert(s && *s);
+  tor_assert(s);
+  tor_assert(*s);
 
   routers = smartlist_create();
 
@@ -848,7 +849,7 @@
   }
   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 @@
   /* 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_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: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -u -d -r1.129 -r1.130
--- test.c	16 Oct 2004 21:57:24 -0000	1.129
+++ test.c	16 Oct 2004 22:14:52 -0000	1.130
@@ -34,7 +34,8 @@
   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]);
     }
   }