summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-11-22 23:28:26 +0000
committerNick Mathewson <nickm@torproject.org>2004-11-22 23:28:26 +0000
commit22dba27d8dd55e3494775b9241e258e494caf5d3 (patch)
tree8e3e1a756c6efc65d8211e884bf5c5b9dd60dea1
parentfe32c2d1412e7a3906fa4f0ae0f99f12de5b882b (diff)
downloadtor-22dba27d8dd55e3494775b9241e258e494caf5d3.tar.gz
tor-22dba27d8dd55e3494775b9241e258e494caf5d3.zip
Normalize a few more kinds of whitespace. We now dislike:
- func (args) - if (x){ This doesn't normalize if(x), for(x); while(x), and friends. svn:r2943
-rw-r--r--src/common/compat.c13
-rw-r--r--src/common/compat.h2
-rw-r--r--src/common/container.c3
-rw-r--r--src/common/util.c3
-rw-r--r--src/or/connection_edge.c2
-rw-r--r--src/or/directory.c2
-rw-r--r--src/or/dirserv.c10
-rw-r--r--src/or/rendservice.c5
-rw-r--r--src/or/router.c2
-rw-r--r--src/or/routerparse.c2
-rw-r--r--src/or/test.c2
11 files changed, 26 insertions, 20 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 395194b37f..4a02dd1c7a 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -239,9 +239,9 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
listener = socket(AF_INET, type, 0);
if (listener == -1)
return -1;
- memset (&listen_addr, 0, sizeof (listen_addr));
+ memset(&listen_addr, 0, sizeof(listen_addr));
listen_addr.sin_family = AF_INET;
- listen_addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ listen_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
listen_addr.sin_port = 0; /* kernel choses port. */
if (bind(listener, (struct sockaddr *) &listen_addr, sizeof (listen_addr))
== -1)
@@ -253,16 +253,16 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
if (connector == -1)
goto tidy_up_and_fail;
/* We want to find out the port number to connect to. */
- size = sizeof (connect_addr);
+ size = sizeof(connect_addr);
if (getsockname(listener, (struct sockaddr *) &connect_addr, &size) == -1)
goto tidy_up_and_fail;
if (size != sizeof (connect_addr))
goto abort_tidy_up_and_fail;
if (connect(connector, (struct sockaddr *) &connect_addr,
- sizeof (connect_addr)) == -1)
+ sizeof(connect_addr)) == -1)
goto tidy_up_and_fail;
- size = sizeof (listen_addr);
+ size = sizeof(listen_addr);
acceptor = accept(listener, (struct sockaddr *) &listen_addr, &size);
if (acceptor == -1)
goto tidy_up_and_fail;
@@ -468,7 +468,8 @@ get_uname(void)
* unix calls fork, on win32 calls beginthread. Returns -1 on failure.
* func should not return, but rather should call spawn_exit.
*/
-int spawn_func(int (*func)(void *), void *data)
+int
+spawn_func(int (*func)(void *), void *data)
{
#ifdef MS_WINDOWS
int rv;
diff --git a/src/common/compat.h b/src/common/compat.h
index 5b0ed36a0c..f62e833544 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -35,7 +35,7 @@
/* GCC can check printf types on arbitrary functions. */
#ifdef __GNUC__
#define CHECK_PRINTF(formatIdx, firstArg) \
- __attribute__ ((format (printf, formatIdx, firstArg)))
+ __attribute__ ((format(printf, formatIdx, firstArg)))
#else
#define CHECK_PRINTF(formatIdx, firstArg)
#endif
diff --git a/src/common/container.c b/src/common/container.c
index ec47adf729..f41dfd76aa 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -597,7 +597,8 @@ int strmap_iter_done(strmap_iter_t *iter)
/** Remove all entries from <b>map</b>, and deallocate storage for those entries.
* If free_val is provided, it is invoked on every value in <b>map</b>.
*/
-void strmap_free(strmap_t *map, void (*free_val)(void*))
+void
+strmap_free(strmap_t *map, void (*free_val)(void*))
{
strmap_entry_t *ent, *next;
for (ent = SPLAY_MIN(strmap_tree, &map->head); ent != NULL; ent = next) {
diff --git a/src/common/util.c b/src/common/util.c
index d3add33e16..3099b125cc 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -540,7 +540,8 @@ static const int days_per_month[] =
/** Return a time_t given a struct tm. The result is given in GMT, and
* does not account for leap seconds.
*/
-time_t tor_timegm (struct tm *tm) {
+time_t
+tor_timegm(struct tm *tm) {
/* This is a pretty ironclad timegm implementation, snarfed from Python2.2.
* It's way more brute-force than fiddling with tzset().
*/
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index be3b07a25f..4ba528c488 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -761,7 +761,7 @@ int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
log_fn(LOG_WARN,"relay begin cell has no \\0. Dropping.");
return 0;
}
- if (parse_addr_port(cell->payload+RELAY_HEADER_SIZE, &address, NULL,&port)<0){
+ if (parse_addr_port(cell->payload+RELAY_HEADER_SIZE,&address,NULL,&port)<0) {
log_fn(LOG_WARN,"Unable to parse addr:port in relay begin cell. Dropping.");
return 0;
}
diff --git a/src/or/directory.c b/src/or/directory.c
index 6273b904c1..68600b59c0 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -594,7 +594,7 @@ connection_dir_client_reached_eof(connection_t *conn)
tor_free(body); tor_free(headers);
return -1;
}
- if(router_load_routerlist_from_directory(body, NULL, 1) < 0){
+ if(router_load_routerlist_from_directory(body, NULL, 1) < 0) {
log_fn(LOG_WARN,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
} else {
log_fn(LOG_INFO,"updated routers.");
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index e96adc0a71..5af1e928c3 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -604,8 +604,9 @@ dirserv_dump_directory_to_string(char *s, size_t maxlen,
return -1;
}
#else
- { int l;
- if(crypto_pk_write_public_key_to_string(private_key, &identity_pkey, &l)<0){
+ {
+ int l;
+ if(crypto_pk_write_public_key_to_string(private_key,&identity_pkey,&l)<0) {
log_fn(LOG_WARN,"write identity_pkey to string failed!");
return -1;
}
@@ -847,8 +848,9 @@ static int generate_runningrouters(crypto_pk_env_t *private_key)
goto err;
}
#else
- { int l;
- if(crypto_pk_write_public_key_to_string(private_key, &identity_pkey, &l)<0){
+ {
+ int l;
+ if(crypto_pk_write_public_key_to_string(private_key,&identity_pkey,&l)<0) {
log_fn(LOG_WARN,"write identity_pkey to string failed!");
goto err;
}
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index a38b536603..d8e86e68f2 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -378,7 +378,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
/* min key length plus digest length plus nickname length */
if (request_len < DIGEST_LEN+REND_COOKIE_LEN+(MAX_NICKNAME_LEN+1)+
- DH_KEY_LEN+42){
+ DH_KEY_LEN+42) {
log_fn(LOG_WARN, "Got a truncated INTRODUCE2 cell on circ %d",
circuit->n_circ_id);
return -1;
@@ -816,7 +816,8 @@ void rend_services_introduce(void) {
/* One period has elapsed; we can try building circuits again. */
service->intro_period_started = now;
service->n_intro_circuits_launched = 0;
- } else if (service->n_intro_circuits_launched>=MAX_INTRO_CIRCS_PER_PERIOD){
+ } else if (service->n_intro_circuits_launched >=
+ MAX_INTRO_CIRCS_PER_PERIOD) {
/* We have failed too many times in this period; wait for the next
* one before we try again. */
continue;
diff --git a/src/or/router.c b/src/or/router.c
index 9690860954..c9b7467d25 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -366,7 +366,7 @@ int init_keys(void) {
if(!cp) {
log_fn(LOG_INFO,"Cached directory %s not present. Ok.",keydir);
} else {
- if(dirserv_load_from_directory_string(cp) < 0){
+ if(dirserv_load_from_directory_string(cp) < 0) {
log_fn(LOG_ERR, "Cached directory %s is corrupt", keydir);
tor_free(cp);
return -1;
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index ca7d6ed5d3..f568d550f2 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -886,7 +886,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s,
}
router->identity_pkey = tok->key;
tok->key = NULL; /* Prevent free */
- if (crypto_pk_get_digest(router->identity_pkey,router->identity_digest)){
+ if (crypto_pk_get_digest(router->identity_pkey,router->identity_digest)) {
log_fn(LOG_WARN, "Couldn't calculate key digest"); goto err;
}
diff --git a/src/or/test.c b/src/or/test.c
index 056ec93004..844cc74288 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -1218,7 +1218,7 @@ test_rend_fns(void)
}
int
-main(int c, char**v){
+main(int c, char**v) {
or_options_t *options = tor_malloc_zero(sizeof(or_options_t));
options_init(options);
set_options(options);