[or-cvs] r17598: {tor} Now that tor_assert is no longer using a broken force-to-boo (tor/trunk/src/or)

nickm at seul.org nickm at seul.org
Thu Dec 11 20:28:51 UTC 2008


Author: nickm
Date: 2008-12-11 15:28:50 -0500 (Thu, 11 Dec 2008)
New Revision: 17598

Modified:
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/routerparse.c
Log:
Now that tor_assert is no longer using a broken force-to-boolean formulation, we can tor_assert a bitfield without a gcc compile error.

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2008-12-11 20:23:46 UTC (rev 17597)
+++ tor/trunk/src/or/connection.c	2008-12-11 20:28:50 UTC (rev 17598)
@@ -2979,7 +2979,7 @@
 
   if (conn->linked_conn) {
     tor_assert(conn->linked_conn->linked_conn == conn);
-    tor_assert(conn->linked != 0);
+    tor_assert(conn->linked);
   }
   if (conn->linked)
     tor_assert(conn->s < 0);
@@ -3030,7 +3030,7 @@
 
       tor_assert(edge_conn->socks_request);
       if (conn->state == AP_CONN_STATE_OPEN) {
-        tor_assert(edge_conn->socks_request->has_finished != 0);
+        tor_assert(edge_conn->socks_request->has_finished);
         if (!conn->marked_for_close) {
           tor_assert(edge_conn->cpath_layer);
           assert_cpath_layer_ok(edge_conn->cpath_layer);

Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c	2008-12-11 20:23:46 UTC (rev 17597)
+++ tor/trunk/src/or/routerparse.c	2008-12-11 20:28:50 UTC (rev 17598)
@@ -1265,7 +1265,7 @@
   }
 
   if ((tok = find_opt_by_keyword(tokens, A_PURPOSE))) {
-    tor_assert(tok->n_args != 0);
+    tor_assert(tok->n_args);
     router->purpose = router_purpose_from_string(tok->args[0]);
   } else {
     router->purpose = ROUTER_PURPOSE_GENERAL;
@@ -1607,7 +1607,7 @@
   tok->key = NULL;
 
   tok = find_by_keyword(tokens, K_FINGERPRINT);
-  tor_assert(tok->n_args > 0);
+  tor_assert(tok->n_args);
   if (base16_decode(fp_declared, DIGEST_LEN, tok->args[0],
                     strlen(tok->args[0]))) {
     log_warn(LD_DIR, "Couldn't decode key certificate fingerprint %s",
@@ -1627,7 +1627,7 @@
 
   tok = find_opt_by_keyword(tokens, K_DIR_ADDRESS);
   if (tok) {
-    tor_assert(tok->n_args != 0);
+    tor_assert(tok->n_args);
     if (parse_addr_port(LOG_WARN, tok->args[0], NULL, &cert->addr,
                         &cert->dir_port)<0) {
       log_warn(LD_DIR, "Couldn't parse dir-address in certificate");
@@ -2004,7 +2004,7 @@
   }
 
   tok = find_by_keyword(tokens, K_FINGERPRINT);
-  tor_assert(tok->n_args != 0);
+  tor_assert(tok->n_args);
   if (base16_decode(ns->identity_digest, DIGEST_LEN, tok->args[0],
                     strlen(tok->args[0]))) {
     log_warn(LD_DIR, "Couldn't decode networkstatus fingerprint %s",
@@ -2013,7 +2013,7 @@
   }
 
   if ((tok = find_opt_by_keyword(tokens, K_CONTACT))) {
-    tor_assert(tok->n_args != 0);
+    tor_assert(tok->n_args);
     ns->contact = tor_strdup(tok->args[0]);
   }
 
@@ -2166,7 +2166,7 @@
   }
 
   tok = find_by_keyword(tokens, K_VOTE_STATUS);
-  tor_assert(tok->n_args != 0);
+  tor_assert(tok->n_args);
   if (!strcmp(tok->args[0], "vote")) {
     ns->type = NS_TYPE_VOTE;
   } else if (!strcmp(tok->args[0], "consensus")) {



More information about the tor-commits mailing list