diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-02-08 08:31:31 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-02-08 08:31:31 -0500 |
commit | d004f06830cc6499489c525c73c2e33832b498e4 (patch) | |
tree | 8b4d3d0350bae6c00e0515cf3c93ee93b605dc3b | |
parent | c30be5a82d47328c311ed4bff925e37b6b40411c (diff) | |
download | tor-d004f06830cc6499489c525c73c2e33832b498e4.tar.gz tor-d004f06830cc6499489c525c73c2e33832b498e4.zip |
fix wide lines, use more locals.
-rw-r--r-- | src/or/dirserv.c | 2 | ||||
-rw-r--r-- | src/or/router.c | 27 |
2 files changed, 16 insertions, 13 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index bafea5e90b..3771818457 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -3103,7 +3103,7 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, DSR_HEX|DSR_SORT_UNIQ); SMARTLIST_FOREACH_BEGIN(digests, const char *, d) { if (router_digest_is_me(d)) { - /* calling router_get_my_routerinfo() to make sure desc_routerinfo exists */ + /* calling router_get_my_routerinfo() to make sure it exists */ const routerinfo_t *ri = router_get_my_routerinfo(); if (ri) smartlist_add(descs_out, (void*) &(ri->cache_info)); diff --git a/src/or/router.c b/src/or/router.c index f09f375830..ff21f41123 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1739,7 +1739,8 @@ router_upload_dir_desc_to_dirservers(int force) int router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) { - if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */ + routerinfo_t *me = router_get_my_routerinfo(); + if (!me) /* make sure routerinfo exists */ return -1; /* make sure it's resolved to something. this way we can't get a @@ -1747,20 +1748,21 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) if (tor_addr_is_null(addr)) return -1; - /* look at router_get_my_routerinfo()->exit_policy for both the v4 and the v6 - * policies. The exit_policy field in router_get_my_routerinfo() is a bit unusual, - * in that it contains IPv6 and IPv6 entries. We don't want to look - * at router_get_my_routerinfo()->ipv6_exit_policy, since that's a port summary. */ + /* look at router_get_my_routerinfo()->exit_policy for both the v4 and the + * v6 policies. The exit_policy field in router_get_my_routerinfo() is a + * bit unusual, in that it contains IPv6 and IPv6 entries. We don't want to + * look at router_get_my_routerinfo()->ipv6_exit_policy, since that's a port + * summary. */ if ((tor_addr_family(addr) == AF_INET || tor_addr_family(addr) == AF_INET6)) { return compare_tor_addr_to_addr_policy(addr, port, - router_get_my_routerinfo()->exit_policy) != ADDR_POLICY_ACCEPTED; + me->exit_policy) != ADDR_POLICY_ACCEPTED; #if 0 } else if (tor_addr_family(addr) == AF_INET6) { return get_options()->IPv6Exit && desc_routerinfo->ipv6_exit_policy && compare_tor_addr_to_short_policy(addr, port, - desc_routerinfo->ipv6_exit_policy) != ADDR_POLICY_ACCEPTED; + me->ipv6_exit_policy) != ADDR_POLICY_ACCEPTED; #endif } else { return -1; @@ -1772,7 +1774,7 @@ router_compare_to_my_exit_policy(const tor_addr_t *addr, uint16_t port) MOCK_IMPL(int, router_my_exit_policy_is_reject_star,(void)) { - if (!router_get_my_routerinfo()) /* make sure desc_routerinfo exists */ + if (!router_get_my_routerinfo()) /* make sure routerinfo exists */ return -1; return router_get_my_routerinfo()->policy_is_reject_star; @@ -1834,12 +1836,13 @@ const char * router_get_my_descriptor(void) { const char *body; - if (!router_get_my_routerinfo()) + routerinfo_t *me = router_get_my_routerinfo(); + if (! me) return NULL; - tor_assert(router_get_my_routerinfo()->cache_info.saved_location == SAVED_NOWHERE); - body = signed_descriptor_get_body(&router_get_my_routerinfo()->cache_info); + tor_assert(me->cache_info.saved_location == SAVED_NOWHERE); + body = signed_descriptor_get_body(&me->cache_info); /* Make sure this is nul-terminated. */ - tor_assert(!body[router_get_my_routerinfo()->cache_info.signed_descriptor_len]); + tor_assert(!body[me->cache_info.signed_descriptor_len]); log_debug(LD_GENERAL,"my desc is '%s'", body); return body; } |