[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] fix wide lines, use more locals.



commit d004f06830cc6499489c525c73c2e33832b498e4
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Feb 8 08:31:31 2016 -0500

    fix wide lines, use more locals.
---
 src/or/dirserv.c |  2 +-
 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 bafea5e..3771818 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 f09f375..ff21f41 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;
 }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits