r12768@catbus: nickm | 2007-05-16 17:25:33 -0400

Fix GCC warnings related to local parameters/variables getting shadowed.


svn:r10198
This commit is contained in:
Nick Mathewson 2007-05-16 22:15:14 +00:00
parent e043b86f47
commit b837191fd0
11 changed files with 51 additions and 51 deletions

View File

@ -455,10 +455,10 @@ circuit_free_all(void)
if (! CIRCUIT_IS_ORIGIN(global_circuitlist)) {
or_circuit_t *or_circ = TO_OR_CIRCUIT(global_circuitlist);
while (or_circ->resolving_streams) {
edge_connection_t *next;
next = or_circ->resolving_streams->next_stream;
edge_connection_t *next_conn;
next_conn = or_circ->resolving_streams->next_stream;
connection_free(TO_CONN(or_circ->resolving_streams));
or_circ->resolving_streams = next;
or_circ->resolving_streams = next_conn;
}
}
circuit_free(global_circuitlist);

View File

@ -1074,10 +1074,10 @@ retry_listeners(int type, config_line_t *cfg,
/* Now open all the listeners that are configured but not opened. */
i = 0;
if (!never_open_conns) {
SMARTLIST_FOREACH(launch, config_line_t *, cfg,
SMARTLIST_FOREACH(launch, config_line_t *, cfg_line,
{
conn = connection_create_listener(cfg->value, (uint16_t) port_option,
type);
conn = connection_create_listener(cfg_line->value,
(uint16_t) port_option, type);
if (!conn) {
i = -1;
} else {
@ -1088,8 +1088,8 @@ retry_listeners(int type, config_line_t *cfg,
}
if (free_launch_elts) {
SMARTLIST_FOREACH(launch, config_line_t *, cfg,
config_free_lines(cfg));
SMARTLIST_FOREACH(launch, config_line_t *, cfg_line,
config_free_lines(cfg_line));
}
smartlist_free(launch);
@ -2351,8 +2351,8 @@ client_check_address_changed(int sock)
/* Okay. If we've used this address previously, we're okay. */
ip_out = ntohl(out_addr.sin_addr.s_addr);
SMARTLIST_FOREACH(outgoing_addrs, uint32_t*, ip,
if (*ip == ip_out) return;
SMARTLIST_FOREACH(outgoing_addrs, uint32_t*, ip_ptr,
if (*ip_ptr == ip_out) return;
);
/* Uh-oh. We haven't connected from this address before. Has the interface
@ -2370,7 +2370,7 @@ client_check_address_changed(int sock)
* keys. First, reset the state. */
log(LOG_NOTICE, LD_NET, "Our IP has changed. Rotating keys...");
last_interface_ip = iface_ip;
SMARTLIST_FOREACH(outgoing_addrs, void*, ip, tor_free(ip));
SMARTLIST_FOREACH(outgoing_addrs, void*, ip_ptr, tor_free(ip_ptr));
smartlist_clear(outgoing_addrs);
smartlist_add(outgoing_addrs, ip);
/* Okay, now change our keys. */

View File

@ -1685,7 +1685,6 @@ handle_control_getinfo(control_connection_t *conn, uint32_t len,
}
});
if (smartlist_len(unrecognized)) {
int i;
for (i=0; i < smartlist_len(unrecognized)-1; ++i)
connection_printf_to_buf(conn,
"552-Unrecognized key \"%s\"\r\n",
@ -1705,10 +1704,10 @@ handle_control_getinfo(control_connection_t *conn, uint32_t len,
connection_write_str_to_buf("\r\n", conn);
} else {
char *esc = NULL;
size_t len;
len = write_escaped_data(v, strlen(v), 1, &esc);
size_t esc_len;
esc_len = write_escaped_data(v, strlen(v), 1, &esc);
connection_printf_to_buf(conn, "250+%s=\r\n", k);
connection_write_to_buf(esc, len, TO_CONN(conn));
connection_write_to_buf(esc, esc_len, TO_CONN(conn));
tor_free(esc);
}
}
@ -2051,12 +2050,12 @@ handle_control_postdescriptor(control_connection_t *conn, uint32_t len,
if (get_purpose(&purp, 0, &purpose) < 0) {
connection_printf_to_buf(conn, "552 Unknown purpose \"%s\"\r\n",
purp);
SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
SMARTLIST_FOREACH(args, char *, arg, tor_free(arg));
smartlist_free(args);
return 0;
}
}
SMARTLIST_FOREACH(args, char *, cp, tor_free(cp));
SMARTLIST_FOREACH(args, char *, arg, tor_free(arg));
smartlist_free(args);
read_escaped_data(cp, len-(cp-body), 1, &desc);
@ -2974,9 +2973,9 @@ control_event_descriptors_changed(smartlist_t *routers)
}
if (EVENT_IS_INTERESTING1S(EVENT_NEW_DESC)) {
char *ids = smartlist_join_strings(identities, " ", 0, &len);
size_t len = strlen(ids)+32;
msg = tor_malloc(len);
tor_snprintf(msg, len, "650 NEWDESC %s\r\n", ids);
size_t ids_len = strlen(ids)+32;
msg = tor_malloc(ids_len);
tor_snprintf(msg, ids_len, "650 NEWDESC %s\r\n", ids);
send_control_event_string(EVENT_NEW_DESC, SHORT_NAMES|ALL_FORMATS, msg);
tor_free(ids);
tor_free(msg);
@ -2984,16 +2983,16 @@ control_event_descriptors_changed(smartlist_t *routers)
if (EVENT_IS_INTERESTING1L(EVENT_NEW_DESC)) {
smartlist_t *names = smartlist_create();
char *ids;
size_t len;
size_t names_len;
SMARTLIST_FOREACH(routers, routerinfo_t *, ri, {
char *b = tor_malloc(MAX_VERBOSE_NICKNAME_LEN+1);
router_get_verbose_nickname(b, ri);
smartlist_add(names, b);
});
ids = smartlist_join_strings(names, " ", 0, &len);
len = strlen(ids)+32;
msg = tor_malloc(len);
tor_snprintf(msg, len, "650 NEWDESC %s\r\n", ids);
ids = smartlist_join_strings(names, " ", 0, &names_len);
names_len = strlen(ids)+32;
msg = tor_malloc(names_len);
tor_snprintf(msg, names_len, "650 NEWDESC %s\r\n", ids);
send_control_event_string(EVENT_NEW_DESC, LONG_NAMES|ALL_FORMATS, msg);
tor_free(ids);
tor_free(msg);

View File

@ -1130,9 +1130,9 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
SMARTLIST_FOREACH(router_get_trusted_dir_servers(),
trusted_dir_server_t *, ds,
{
char *cp = tor_malloc(HEX_DIGEST_LEN+1);
base16_encode(cp, HEX_DIGEST_LEN+1, ds->digest, DIGEST_LEN);
smartlist_add(which, cp);
char *hex = tor_malloc(HEX_DIGEST_LEN+1);
base16_encode(hex, HEX_DIGEST_LEN+1, ds->digest, DIGEST_LEN);
smartlist_add(which, hex);
});
} else {
/* Can we even end up here? -- weasel*/
@ -1160,7 +1160,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
if (smartlist_len(which)) {
dir_networkstatus_download_failed(which, status_code);
}
SMARTLIST_FOREACH(which, char *, cp, tor_free(cp));
SMARTLIST_FOREACH(which, char *, s, tor_free(s));
smartlist_free(which);
}
}
@ -1711,7 +1711,7 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
"Client asked for network status lists, but we've been "
"writing too many bytes lately. Sending 503 Dir busy.");
write_http_status_line(conn, 503, "Directory busy, try again later");
SMARTLIST_FOREACH(dir_fps, char *, cp, tor_free(cp));
SMARTLIST_FOREACH(dir_fps, char *, fp, tor_free(fp));
smartlist_free(dir_fps);
return 0;
}

View File

@ -1679,8 +1679,8 @@ evdns_server_request_respond(struct evdns_server_request *_req, int err)
r = sendto(port->socket, req->response, req->response_len, 0,
(struct sockaddr*) &req->addr, req->addrlen);
if (r<0) {
int err = last_error(port->socket);
if (! error_is_eagain(err))
int e = last_error(port->socket);
if (! error_is_eagain(e))
return -1;
if (port->pending_replies) {
@ -2514,7 +2514,7 @@ search_try_next(struct request *const req) {
// this name without a postfix
if (string_num_dots(req->search_origname) < req->search_state->ndots) {
// yep, we need to try it raw
struct request *const newreq = request_new(req->request_type, req->search_origname, req->search_flags, req->user_callback, req->user_pointer);
newreq = request_new(req->request_type, req->search_origname, req->search_flags, req->user_callback, req->user_pointer);
log(EVDNS_LOG_DEBUG, "Search: trying raw query %s", req->search_origname);
if (newreq) {
request_submit(newreq);

View File

@ -221,11 +221,11 @@ accounting_parse_options(or_options_t *options, int validate_only)
cfg_start_hour = (int)h;
cfg_start_min = (int)m;
}
SMARTLIST_FOREACH(items, char *, s, tor_free(s));
SMARTLIST_FOREACH(items, char *, item, tor_free(item));
smartlist_free(items);
return 0;
err:
SMARTLIST_FOREACH(items, char *, s, tor_free(s));
SMARTLIST_FOREACH(items, char *, item, tor_free(item));
smartlist_free(items);
return -1;
}

View File

@ -1116,8 +1116,9 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
return 0;
}
if (circ->n_conn) {
uint8_t reason = *(uint8_t*)(cell->payload + RELAY_HEADER_SIZE);
connection_or_send_destroy(circ->n_circ_id, circ->n_conn, reason);
uint8_t trunc_reason = *(uint8_t*)(cell->payload + RELAY_HEADER_SIZE);
connection_or_send_destroy(circ->n_circ_id, circ->n_conn,
trunc_reason);
circuit_set_n_circid_orconn(circ, 0, NULL);
}
log_debug(LD_EXIT, "Processed 'truncate', replying.");

View File

@ -664,7 +664,7 @@ rep_hist_update_state(or_state_t *state)
s_values = r?&state->BWHistoryReadValues :&state->BWHistoryWriteValues;
if (*s_values) {
SMARTLIST_FOREACH(*s_values, char *, cp, tor_free(cp));
SMARTLIST_FOREACH(*s_values, char *, val, tor_free(val));
smartlist_free(*s_values);
}
if (! server_mode(get_options())) {

View File

@ -1321,11 +1321,11 @@ router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router,
if (router->declared_family && smartlist_len(router->declared_family)) {
size_t n;
char *s = smartlist_join_strings(router->declared_family, " ", 0, &n);
char *family = smartlist_join_strings(router->declared_family, " ", 0, &n);
n += strlen("family ") + 2; /* 1 for \n, 1 for \0. */
family_line = tor_malloc(n);
tor_snprintf(family_line, n, "family %s\n", s);
tor_free(s);
tor_snprintf(family_line, n, "family %s\n", family);
tor_free(family);
} else {
family_line = tor_strdup("");
}

View File

@ -611,7 +611,7 @@ router_parse_directory(const char *str)
if (check_signature_token(digest, tok, declared_key, 1, "directory")<0)
goto err;
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
smartlist_free(tokens);
tokens = NULL;
@ -649,7 +649,7 @@ router_parse_directory(const char *str)
done:
if (declared_key) crypto_free_pk_env(declared_key);
if (tokens) {
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
smartlist_free(tokens);
}
return r;
@ -707,7 +707,7 @@ router_parse_runningrouters(const char *str)
err:
if (declared_key) crypto_free_pk_env(declared_key);
if (tokens) {
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
smartlist_free(tokens);
}
return r;
@ -1139,7 +1139,7 @@ router_parse_entry_from_string(const char *s, const char *end,
router = NULL;
done:
if (tokens) {
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
smartlist_free(tokens);
}
if (exit_policy_tokens) {
@ -1254,7 +1254,7 @@ extrainfo_parse_entry_from_string(const char *s, const char *end,
extrainfo = NULL;
done:
if (tokens) {
SMARTLIST_FOREACH(tokens, directory_token_t *, tok, token_free(tok));
SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_free(t));
smartlist_free(tokens);
}
return extrainfo;

View File

@ -237,18 +237,18 @@ do_resolve(const char *hostname, uint32_t sockshost, uint16_t socksport,
}
*result_addr = ntohl(get_uint32(reply_buf));
} else if (reply_buf[3] == 3) {
size_t len;
size_t result_len;
if (read_all(s, reply_buf, 1, 1) != 1) {
log_err(LD_NET, "Error reading address_length in socks5 response.");
return -1;
}
len = *(uint8_t*)(reply_buf);
*result_hostname = tor_malloc(len+1);
if (read_all(s, *result_hostname, len, 1) != (int) len) {
result_len = *(uint8_t*)(reply_buf);
*result_hostname = tor_malloc(result_len+1);
if (read_all(s, *result_hostname, result_len, 1) != (int) result_len) {
log_err(LD_NET, "Error reading hostname in socks5 response.");
return -1;
}
(*result_hostname)[len] = '\0';
(*result_hostname)[result_len] = '\0';
}
}