[or-cvs] Fix verbose compiler warnings, including one in routerlist....
Nick Mathewson
nickm at seul.org
Wed Oct 5 02:06:38 UTC 2005
Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv5860/src/or
Modified Files:
connection_edge.c control.c main.c or.h rendservice.c
routerlist.c
Log Message:
Fix verbose compiler warnings, including one in routerlist.c that would have been an actual error. Normalize whitespace. Enforce convention that "address" is a hostname and "addr" is an IPv4 address.
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.352
retrieving revision 1.353
diff -u -d -r1.352 -r1.353
--- connection_edge.c 4 Oct 2005 22:23:31 -0000 1.352
+++ connection_edge.c 5 Oct 2005 02:06:35 -0000 1.353
@@ -499,16 +499,16 @@
/** Free storage held by a virtaddress_entry_t* entry in <b>ent</b> */
static void
-addressmap_virtaddress_remove(const char *addr, addressmap_entry_t *ent)
+addressmap_virtaddress_remove(const char *address, addressmap_entry_t *ent)
{
if (ent && ent->new_address && address_is_in_virtual_range(ent->new_address)) {
virtaddress_entry_t *ve =
strmap_get(virtaddress_reversemap, ent->new_address);
/*log_fn(LOG_NOTICE,"remove reverse mapping for %s",ent->new_address);*/
if (ve) {
- if (!strcmp(addr, ve->ipv4_address))
+ if (!strcmp(address, ve->ipv4_address))
tor_free(ve->ipv4_address);
- if (!strcmp(addr, ve->hostname_address))
+ if (!strcmp(address, ve->hostname_address))
tor_free(ve->hostname_address);
if (!ve->ipv4_address && !ve->hostname_address) {
tor_free(ve);
@@ -520,9 +520,9 @@
/* DOCDOC */
static void
-addressmap_ent_remove(const char *addr, addressmap_entry_t *ent)
+addressmap_ent_remove(const char *address, addressmap_entry_t *ent)
{
- addressmap_virtaddress_remove(addr, ent);
+ addressmap_virtaddress_remove(address, ent);
addressmap_ent_free(ent);
}
@@ -735,15 +735,15 @@
* client_dns_get_unused_address.
**/
int
-address_is_in_virtual_range(const char *addr)
+address_is_in_virtual_range(const char *address)
{
struct in_addr in;
- tor_assert(addr);
- if (!strcasecmpend(addr, ".virtual")) {
+ tor_assert(address);
+ if (!strcasecmpend(address, ".virtual")) {
return 1;
- } else if (tor_inet_aton(addr, &in)) {
- uint32_t a = ntohl(in.s_addr);
- if (a >= MIN_UNUSED_IPV4 && a <= MAX_UNUSED_IPV4)
+ } else if (tor_inet_aton(address, &in)) {
+ uint32_t addr = ntohl(in.s_addr);
+ if (addr >= MIN_UNUSED_IPV4 && addr <= MAX_UNUSED_IPV4)
return 1;
}
return 0;
Index: control.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/control.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- control.c 4 Oct 2005 22:23:31 -0000 1.136
+++ control.c 5 Oct 2005 02:06:35 -0000 1.137
@@ -1120,20 +1120,20 @@
} else if (!is_plausible_address(to)) {
log_fn(LOG_WARN,"Skipping invalid argument '%s' in MapAddress msg",to);
} else if (!strcmp(from, ".") || !strcmp(from, "0.0.0.0")) {
- const char *addr = addressmap_register_virtual_address(
+ const char *address = addressmap_register_virtual_address(
!strcmp(from,".") ? RESOLVED_TYPE_HOSTNAME : RESOLVED_TYPE_IPV4,
tor_strdup(to));
- if (!addr) {
+ if (!address) {
log_fn(LOG_WARN,
"Unable to allocate address for '%s' in MapAddress msg",
safe_str(line));
} else {
- size_t anslen = strlen(addr)+strlen(to)+8;
+ size_t anslen = strlen(address)+strlen(to)+8;
char *ans = tor_malloc(anslen);
if (v0)
- tor_snprintf(ans, anslen, "%s %s", addr, to);
+ tor_snprintf(ans, anslen, "%s %s", address, to);
else
- tor_snprintf(ans, anslen, "250-%s=%s", addr, to);
+ tor_snprintf(ans, anslen, "250-%s=%s", address, to);
smartlist_add(reply, ans);
}
} else {
@@ -1677,7 +1677,6 @@
return 0;
}
-
/** Callled when we get a POSTDESCRIPTORT message. Try to learn the provided
* descriptor, and report succcess or failure. */
static int
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.567
retrieving revision 1.568
diff -u -d -r1.567 -r1.568
--- main.c 5 Oct 2005 00:22:56 -0000 1.567
+++ main.c 5 Oct 2005 02:06:36 -0000 1.568
@@ -1983,3 +1983,4 @@
tor_cleanup();
return -1;
}
+
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.703
retrieving revision 1.704
diff -u -d -r1.703 -r1.704
--- or.h 5 Oct 2005 01:53:44 -0000 1.703
+++ or.h 5 Oct 2005 02:06:36 -0000 1.704
@@ -2140,7 +2140,7 @@
int router_exit_policy_rejects_all(routerinfo_t *router);
void add_trusted_dir_server(const char *nickname,
- const char *addr, uint16_t port,
+ const char *address, uint16_t port,
const char *digest, int supports_v1);
void clear_trusted_dir_servers(void);
networkstatus_t *networkstatus_get_by_digest(const char *digest);
Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/rendservice.c,v
retrieving revision 1.140
retrieving revision 1.141
diff -u -d -r1.140 -r1.141
--- rendservice.c 4 Oct 2005 22:23:31 -0000 1.140
+++ rendservice.c 5 Oct 2005 02:06:36 -0000 1.141
@@ -18,7 +18,7 @@
typedef struct rend_service_port_config_t {
uint16_t virtual_port;
uint16_t real_port;
- uint32_t real_address;
+ uint32_t real_addr;
} rend_service_port_config_t;
/** Try to maintain this many intro points per service if possible. */
@@ -128,7 +128,7 @@
for (i = 0; i < smartlist_len(service->ports); ++i) {
char addrbuf[INET_NTOA_BUF_LEN];
p = smartlist_get(service->ports, i);
- addr.s_addr = htonl(p->real_address);
+ addr.s_addr = htonl(p->real_addr);
tor_inet_ntoa(&addr, addrbuf, sizeof(addrbuf));
log_fn(LOG_DEBUG,"Service maps port %d to %s:%d",
p->virtual_port, addrbuf, p->real_port);
@@ -191,7 +191,7 @@
result = tor_malloc(sizeof(rend_service_port_config_t));
result->virtual_port = virtport;
result->real_port = realport;
- result->real_address = addr;
+ result->real_addr = addr;
err:
SMARTLIST_FOREACH(sl, char *, c, tor_free(c));
smartlist_free(sl);
@@ -1094,7 +1094,7 @@
for (i = 0; i < smartlist_len(service->ports); ++i) {
p = smartlist_get(service->ports, i);
if (conn->port == p->virtual_port) {
- conn->addr = p->real_address;
+ conn->addr = p->real_addr;
conn->port = p->real_port;
return 0;
}
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerlist.c,v
retrieving revision 1.327
retrieving revision 1.328
diff -u -d -r1.327 -r1.328
--- routerlist.c 5 Oct 2005 01:53:44 -0000 1.327
+++ routerlist.c 5 Oct 2005 02:06:36 -0000 1.328
@@ -1317,8 +1317,8 @@
router_load_single_router(const char *s, const char **msg)
{
routerinfo_t *ri;
- tor_assert(msg);
smartlist_t *lst;
+ tor_assert(msg);
*msg = NULL;
if (!(ri = router_parse_entry_from_string(s, NULL))) {
@@ -2406,8 +2406,8 @@
const char *d = strmap_get_lc(name_map, the_name);
if (d && d != conflict)
rs_out->status.is_named = 1;
- if (smartlist_string_isin(warned_conflicts, rs->nickname))
- smartlist_string_remove(warned_conflicts, rs->nickname);
+ if (smartlist_string_isin(warned_conflicts, rs_out->status.nickname))
+ smartlist_string_remove(warned_conflicts, rs_out->status.nickname);
}
if (rs_out->status.is_named)
strlcpy(rs_out->status.nickname, the_name, sizeof(rs_out->status.nickname));
More information about the tor-commits
mailing list