Unindent long-misindented blocks.

We switched these to be "if (1) " a while back, so we could keep
the indentation and avoid merge conflicts.  But it's nice to clean
up from time to time.
This commit is contained in:
Nick Mathewson 2017-01-02 12:16:57 -05:00
parent 26651d7fdb
commit 97ed2ce085
3 changed files with 211 additions and 217 deletions

View File

@ -2318,7 +2318,6 @@ channel_flush_some_cells_from_outgoing_queue(channel_t *chan,
free_q = 0; free_q = 0;
handed_off = 0; handed_off = 0;
if (1) {
/* Figure out how big it is for statistical purposes */ /* Figure out how big it is for statistical purposes */
cell_size = channel_get_cell_queue_entry_size(chan, q); cell_size = channel_get_cell_queue_entry_size(chan, q);
/* /*
@ -2436,7 +2435,6 @@ channel_flush_some_cells_from_outgoing_queue(channel_t *chan,
} }
} }
} }
}
/* Did we drain the queue? */ /* Did we drain the queue? */
if (TOR_SIMPLEQ_EMPTY(&chan->outgoing_queue)) { if (TOR_SIMPLEQ_EMPTY(&chan->outgoing_queue)) {

View File

@ -5313,7 +5313,7 @@ addressmap_register_auto(const char *from, const char *to,
int from_wildcard = 0, to_wildcard = 0; int from_wildcard = 0, to_wildcard = 0;
*msg = "whoops, forgot the error message"; *msg = "whoops, forgot the error message";
if (1) {
if (!strcmp(to, "*") || !strcmp(from, "*")) { if (!strcmp(to, "*") || !strcmp(from, "*")) {
*msg = "can't remap from or to *"; *msg = "can't remap from or to *";
return -1; return -1;
@ -5341,7 +5341,7 @@ addressmap_register_auto(const char *from, const char *to,
addressmap_register(from, tor_strdup(to), expires, addrmap_source, addressmap_register(from, tor_strdup(to), expires, addrmap_source,
from_wildcard, to_wildcard); from_wildcard, to_wildcard);
}
return 0; return 0;
} }

View File

@ -1857,7 +1857,7 @@ body_is_plausible(const char *body, size_t len, int purpose)
if (purpose == DIR_PURPOSE_FETCH_MICRODESC) { if (purpose == DIR_PURPOSE_FETCH_MICRODESC) {
return (!strcmpstart(body,"onion-key")); return (!strcmpstart(body,"onion-key"));
} }
if (1) {
if (!strcmpstart(body,"router") || if (!strcmpstart(body,"router") ||
!strcmpstart(body,"network-status")) !strcmpstart(body,"network-status"))
return 1; return 1;
@ -1865,7 +1865,7 @@ body_is_plausible(const char *body, size_t len, int purpose)
if (!TOR_ISPRINT(body[i]) && !TOR_ISSPACE(body[i])) if (!TOR_ISPRINT(body[i]) && !TOR_ISSPACE(body[i]))
return 0; return 0;
} }
}
return 1; return 1;
} }
@ -3030,14 +3030,13 @@ handle_get_current_consensus(dir_connection_t *conn,
smartlist_t *dir_fps = smartlist_new(); smartlist_t *dir_fps = smartlist_new();
long lifetime = NETWORKSTATUS_CACHE_LIFETIME; long lifetime = NETWORKSTATUS_CACHE_LIFETIME;
if (1) {
networkstatus_t *v; networkstatus_t *v;
time_t now = time(NULL); time_t now = time(NULL);
const char *want_fps = NULL; const char *want_fps = NULL;
char *flavor = NULL; char *flavor = NULL;
int flav = FLAV_NS; int flav = FLAV_NS;
#define CONSENSUS_URL_PREFIX "/tor/status-vote/current/consensus/" #define CONSENSUS_URL_PREFIX "/tor/status-vote/current/consensus/"
#define CONSENSUS_FLAVORED_PREFIX "/tor/status-vote/current/consensus-" #define CONSENSUS_FLAVORED_PREFIX "/tor/status-vote/current/consensus-"
/* figure out the flavor if any, and who we wanted to sign the thing */ /* figure out the flavor if any, and who we wanted to sign the thing */
if (!strcmpstart(url, CONSENSUS_FLAVORED_PREFIX)) { if (!strcmpstart(url, CONSENSUS_FLAVORED_PREFIX)) {
const char *f, *cp; const char *f, *cp;
@ -3086,7 +3085,6 @@ handle_get_current_consensus(dir_connection_t *conn,
smartlist_add(dir_fps, fp); smartlist_add(dir_fps, fp);
} }
lifetime = (v && v->fresh_until > now) ? v->fresh_until - now : 0; lifetime = (v && v->fresh_until > now) ? v->fresh_until - now : 0;
}
if (!smartlist_len(dir_fps)) { /* we failed to create/cache cp */ if (!smartlist_len(dir_fps)) { /* we failed to create/cache cp */
write_http_status_line(conn, 503, "Network status object unavailable"); write_http_status_line(conn, 503, "Network status object unavailable");
@ -3122,7 +3120,6 @@ handle_get_current_consensus(dir_connection_t *conn,
goto done; goto done;
} }
if (1) {
tor_addr_t addr; tor_addr_t addr;
if (tor_addr_parse(&addr, (TO_CONN(conn))->address) >= 0) { if (tor_addr_parse(&addr, (TO_CONN(conn))->address) >= 0) {
geoip_note_client_seen(GEOIP_CLIENT_NETWORKSTATUS, geoip_note_client_seen(GEOIP_CLIENT_NETWORKSTATUS,
@ -3137,7 +3134,6 @@ handle_get_current_consensus(dir_connection_t *conn,
geoip_start_dirreq(TO_CONN(conn)->global_identifier, dlen, geoip_start_dirreq(TO_CONN(conn)->global_identifier, dlen,
DIRREQ_DIRECT); DIRREQ_DIRECT);
} }
}
write_http_response_header(conn, -1, compressed, write_http_response_header(conn, -1, compressed,
smartlist_len(dir_fps) == 1 ? lifetime : 0); smartlist_len(dir_fps) == 1 ? lifetime : 0);