[tor-commits] [tor/master] config: Styling fix + use fmt_addr()

nickm at torproject.org nickm at torproject.org
Thu Jun 4 14:36:23 UTC 2020


commit 8b568b50a5054f5e94d7085682e717b4eab58ce5
Author: c <c at chroniko.jp>
Date:   Thu Jun 4 13:15:27 2020 +0000

    config: Styling fix + use fmt_addr()
    
    Conform to C99 as suggested by nickm on #32888 and use fmt_addr() rather
    than tor_addr_to_str_dup()
---
 src/lib/net/address.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/lib/net/address.c b/src/lib/net/address.c
index 0571f48a3..b09c9115c 100644
--- a/src/lib/net/address.c
+++ b/src/lib/net/address.c
@@ -1693,16 +1693,12 @@ get_interface_address6,(int severity, sa_family_t family, tor_addr_t *addr))
   /* Find the first non-internal address, or the last internal address
    * Ideally, we want the default route, see #12377 for details */
   SMARTLIST_FOREACH_BEGIN(addrs, tor_addr_t *, a) {
-    char *addr_str;
-    int is_internal;
     tor_addr_copy(addr, a);
-    is_internal = tor_addr_is_internal(a, 0);
+    const bool is_internal = tor_addr_is_internal(a, 0);
     rv = 0;
 
-    addr_str = tor_addr_to_str_dup(addr);
     log_debug(LD_NET, "Found %s interface address '%s'",
-              (is_internal ? "internal" : "external"), addr_str);
-    tor_free(addr_str);
+              (is_internal ? "internal" : "external"), fmt_addr(addr));
 
     /* If we found a non-internal address, declare success.  Otherwise,
      * keep looking. */





More information about the tor-commits mailing list