[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r10198: Fix GCC warnings related to local parameters/variables getti (in tor/trunk: . src/or src/tools)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r10198: Fix GCC warnings related to local parameters/variables getti (in tor/trunk: . src/or src/tools)
- From: nickm@xxxxxxxx
- Date: Wed, 16 May 2007 18:15:18 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 16 May 2007 18:15:49 -0400
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2007-05-16 18:15:14 -0400 (Wed, 16 May 2007)
New Revision: 10198
Modified:
tor/trunk/
tor/trunk/src/or/circuitlist.c
tor/trunk/src/or/connection.c
tor/trunk/src/or/control.c
tor/trunk/src/or/directory.c
tor/trunk/src/or/eventdns.c
tor/trunk/src/or/hibernate.c
tor/trunk/src/or/relay.c
tor/trunk/src/or/rephist.c
tor/trunk/src/or/router.c
tor/trunk/src/or/routerparse.c
tor/trunk/src/tools/tor-resolve.c
Log:
r12768@catbus: nickm | 2007-05-16 17:25:33 -0400
Fix GCC warnings related to local parameters/variables getting shadowed.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r12768] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/circuitlist.c
===================================================================
--- tor/trunk/src/or/circuitlist.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/circuitlist.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -455,10 +455,10 @@
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);
Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/connection.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -1074,10 +1074,10 @@
/* 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 @@
}
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 @@
/* 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 @@
* 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. */
Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/control.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -1685,7 +1685,6 @@
}
});
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 @@
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 @@
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 @@
}
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 @@
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);
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/directory.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -1130,9 +1130,9 @@
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 @@
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 @@
"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;
}
Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/eventdns.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -1679,8 +1679,8 @@
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 @@
// 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);
Modified: tor/trunk/src/or/hibernate.c
===================================================================
--- tor/trunk/src/or/hibernate.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/hibernate.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -221,11 +221,11 @@
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;
}
Modified: tor/trunk/src/or/relay.c
===================================================================
--- tor/trunk/src/or/relay.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/relay.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -1116,8 +1116,9 @@
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.");
Modified: tor/trunk/src/or/rephist.c
===================================================================
--- tor/trunk/src/or/rephist.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/rephist.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -664,7 +664,7 @@
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())) {
Modified: tor/trunk/src/or/router.c
===================================================================
--- tor/trunk/src/or/router.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/router.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -1321,11 +1321,11 @@
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("");
}
Modified: tor/trunk/src/or/routerparse.c
===================================================================
--- tor/trunk/src/or/routerparse.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/or/routerparse.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -611,7 +611,7 @@
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 @@
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 @@
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 = 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 = 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;
Modified: tor/trunk/src/tools/tor-resolve.c
===================================================================
--- tor/trunk/src/tools/tor-resolve.c 2007-05-16 17:36:49 UTC (rev 10197)
+++ tor/trunk/src/tools/tor-resolve.c 2007-05-16 22:15:14 UTC (rev 10198)
@@ -237,18 +237,18 @@
}
*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';
}
}