summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-16 22:15:14 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-16 22:15:14 +0000
commitb837191fd0e897cbc5fc33874190bab8bbb83268 (patch)
tree96b7bf77047a1873c56931c4f1387cd3c36f79c8 /src
parente043b86f47185e0d9df53dab12d42e46c8c35b83 (diff)
downloadtor-b837191fd0e897cbc5fc33874190bab8bbb83268.tar.gz
tor-b837191fd0e897cbc5fc33874190bab8bbb83268.zip
r12768@catbus: nickm | 2007-05-16 17:25:33 -0400
Fix GCC warnings related to local parameters/variables getting shadowed. svn:r10198
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitlist.c6
-rw-r--r--src/or/connection.c16
-rw-r--r--src/or/control.c27
-rw-r--r--src/or/directory.c10
-rw-r--r--src/or/eventdns.c6
-rw-r--r--src/or/hibernate.c4
-rw-r--r--src/or/relay.c5
-rw-r--r--src/or/rephist.c2
-rw-r--r--src/or/router.c6
-rw-r--r--src/or/routerparse.c10
-rw-r--r--src/tools/tor-resolve.c10
11 files changed, 51 insertions, 51 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c
index 44f0566596..4b455e958f 100644
--- a/src/or/circuitlist.c
+++ b/src/or/circuitlist.c
@@ -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);
diff --git a/src/or/connection.c b/src/or/connection.c
index 7824e3844f..0298e44210 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -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. */
diff --git a/src/or/control.c b/src/or/control.c
index 5100c16866..0fbcb5eabb 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -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);
diff --git a/src/or/directory.c b/src/or/directory.c
index be71678c7f..09c2746f72 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -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;
}
diff --git a/src/or/eventdns.c b/src/or/eventdns.c
index 6d504bd576..fb267babc7 100644
--- a/src/or/eventdns.c
+++ b/src/or/eventdns.c
@@ -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);
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index 8dd9997465..6c5e711cae 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -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;
}
diff --git a/src/or/relay.c b/src/or/relay.c
index 514f6210c0..469741f95b 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -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.");
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 802458c56f..ae9442dd55 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -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())) {
diff --git a/src/or/router.c b/src/or/router.c
index d510b93282..3328ce77de 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -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("");
}
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 736a8b1c62..1dff041f08 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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;
diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c
index 328c74e4c9..3eebb57a6e 100644
--- a/src/tools/tor-resolve.c
+++ b/src/tools/tor-resolve.c
@@ -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';
}
}