Don't shadow parameters with local variables

This is a little error-prone when the local has a different type
from the parameter, and is very error-prone with both have the same
type.  Let's not do this.

Fixes CID #437,438,439,440,441.
This commit is contained in:
Nick Mathewson 2011-07-01 11:33:07 -04:00
parent a0ae80788c
commit 1d18c2deb6
5 changed files with 20 additions and 20 deletions

View file

@ -2592,7 +2592,7 @@ client_likes_consensus(networkstatus_t *v, const char *want_url)
* Always return 0. */
static int
directory_handle_command_get(dir_connection_t *conn, const char *headers,
const char *body, size_t body_len)
const char *req_body, size_t req_body_len)
{
size_t dlen;
char *url, *url_mem, *header;
@ -2602,8 +2602,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
size_t url_len;
/* We ignore the body of a GET request. */
(void)body;
(void)body_len;
(void)req_body;
(void)req_body_len;
log_debug(LD_DIRSERV,"Received GET command.");

View file

@ -1831,8 +1831,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 error = last_error(port->socket);
if (! error_is_eagain(error))
return -1;
if (port->pending_replies) {

View file

@ -83,15 +83,15 @@ policy_expand_private(smartlist_t **policy)
continue;
}
for (i = 0; private_nets[i]; ++i) {
addr_policy_t policy;
memcpy(&policy, p, sizeof(addr_policy_t));
policy.is_private = 0;
policy.is_canonical = 0;
if (tor_addr_parse_mask_ports(private_nets[i], &policy.addr,
&policy.maskbits, &port_min, &port_max)<0) {
addr_policy_t newpolicy;
memcpy(&newpolicy, p, sizeof(addr_policy_t));
newpolicy.is_private = 0;
newpolicy.is_canonical = 0;
if (tor_addr_parse_mask_ports(private_nets[i], &newpolicy.addr,
&newpolicy.maskbits, &port_min, &port_max)<0) {
tor_assert(0);
}
smartlist_add(tmp, addr_policy_get_canonical_entry(&policy));
smartlist_add(tmp, addr_policy_get_canonical_entry(&newpolicy));
}
addr_policy_free(p);
});

View file

@ -2337,13 +2337,13 @@ connection_or_flush_from_first_active_circuit(or_connection_t *conn, int max,
/* Calculate the exact time that this cell has spent in the queue. */
if (get_options()->CellStatistics && !CIRCUIT_IS_ORIGIN(circ)) {
struct timeval now;
struct timeval tvnow;
uint32_t flushed;
uint32_t cell_waiting_time;
insertion_time_queue_t *it_queue = queue->insertion_times;
tor_gettimeofday_cached(&now);
flushed = (uint32_t)((now.tv_sec % SECONDS_IN_A_DAY) * 100L +
(uint32_t)now.tv_usec / (uint32_t)10000L);
tor_gettimeofday_cached(&tvnow);
flushed = (uint32_t)((tvnow.tv_sec % SECONDS_IN_A_DAY) * 100L +
(uint32_t)tvnow.tv_usec / (uint32_t)10000L);
if (!it_queue || !it_queue->first) {
log_info(LD_GENERAL, "Cannot determine insertion time of cell. "
"Looks like the CellStatistics option was "

View file

@ -3512,10 +3512,10 @@ networkstatus_parse_detached_signatures(const char *s, const char *eos)
siglist = detached_get_signatures(sigs, flavor);
is_duplicate = 0;
SMARTLIST_FOREACH(siglist, document_signature_t *, s, {
if (s->alg == alg &&
tor_memeq(id_digest, s->identity_digest, DIGEST_LEN) &&
tor_memeq(sk_digest, s->signing_key_digest, DIGEST_LEN)) {
SMARTLIST_FOREACH(siglist, document_signature_t *, dsig, {
if (dsig->alg == alg &&
tor_memeq(id_digest, dsig->identity_digest, DIGEST_LEN) &&
tor_memeq(sk_digest, dsig->signing_key_digest, DIGEST_LEN)) {
is_duplicate = 1;
}
});