summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-10-16 22:14:52 +0000
committerRoger Dingledine <arma@torproject.org>2004-10-16 22:14:52 +0000
commitde65052312ff9ddd86e492985008bd5ca61d7aa9 (patch)
tree96a2b81c47b4e35e465aa01d8328517a1525d752
parent25a046df7422560b16dfdb302df9621309d5fa77 (diff)
downloadtor-de65052312ff9ddd86e492985008bd5ca61d7aa9.tar.gz
tor-de65052312ff9ddd86e492985008bd5ca61d7aa9.zip
don't assert multiple things in the same tor_assert()
svn:r2544
-rw-r--r--src/or/buffers.c10
-rw-r--r--src/or/circuitbuild.c23
-rw-r--r--src/or/circuituse.c7
-rw-r--r--src/or/config.c3
-rw-r--r--src/or/connection.c24
-rw-r--r--src/or/connection_or.c13
-rw-r--r--src/or/cpuworker.c6
-rw-r--r--src/or/directory.c25
-rw-r--r--src/or/dns.c6
-rw-r--r--src/or/main.c23
-rw-r--r--src/or/or.h1
-rw-r--r--src/or/relay.c16
-rw-r--r--src/or/rendclient.c6
-rw-r--r--src/or/rendservice.c6
-rw-r--r--src/or/router.c3
-rw-r--r--src/or/routerparse.c15
-rw-r--r--src/or/test.c3
17 files changed, 124 insertions, 66 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 26c1e568ab..350d922f74 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -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 */
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index a98821cca4..c5d16d270d 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -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;
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 057a2a85a5..9ce848038f 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -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;
}
diff --git a/src/or/config.c b/src/or/config.c
index dea2b62527..7d36ddc059 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -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);
diff --git a/src/or/connection.c b/src/or/connection.c
index 08bae131f5..477353b5f4 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -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);
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index ccbb3f54cb..7ad0230d4a 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -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);
diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c
index 6abcab5d9a..1d6eee4bd9 100644
--- a/src/or/cpuworker.c
+++ b/src/or/cpuworker.c
@@ -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.");
diff --git a/src/or/directory.c b/src/or/directory.c
index 0f4b4a00d7..5a5ff282ab 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -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.",
diff --git a/src/or/dns.c b/src/or/dns.c
index 56f7378982..17bb58c594 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -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.");
diff --git a/src/or/main.c b/src/or/main.c
index 13c53d60b6..8c3e3e36ae 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -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;
}
diff --git a/src/or/or.h b/src/or/or.h
index c90c275eed..da321a44c0 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -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. */
diff --git a/src/or/relay.c b/src/or/relay.c
index 3c353b71d4..f00d76525a 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -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);
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 70f0564a5f..e6a990bd2b 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -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,
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 2c86b4385f..028c2010dc 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -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);
diff --git a/src/or/router.c b/src/or/router.c
index 26a4b97f6d..08743abf8d 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -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)
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 6a759fdd1f..8700502a0a 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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))
diff --git a/src/or/test.c b/src/or/test.c
index f317d674cd..7506d5deb1 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -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]);
}
}