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

[tor-commits] [tor/master] Tweak address.c to use a little c99 syntax



commit 0ca83872468af59b94e14fe7fdfcb38cb5a3f496
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Sep 25 11:22:02 2014 -0400

    Tweak address.c to use a little c99 syntax
    
    Since address.c is the first file to get compiled, let's have it use
    a little judicious c99 in order to catch broken compilers that
    somehow make it past our autoconf tests.
---
 src/common/address.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/common/address.c b/src/common/address.c
index 3a78f0b..f79736d 100644
--- a/src/common/address.c
+++ b/src/common/address.c
@@ -323,10 +323,9 @@ tor_addr_is_internal_(const tor_addr_t *addr, int for_listening,
 {
   uint32_t iph4 = 0;
   uint32_t iph6[4];
-  sa_family_t v_family;
 
   tor_assert(addr);
-  v_family = tor_addr_family(addr);
+  sa_family_t v_family = tor_addr_family(addr);
 
   if (v_family == AF_INET) {
     iph4 = tor_addr_to_ipv4h(addr);
@@ -605,7 +604,7 @@ tor_addr_parse_mask_ports(const char *s,
   int any_flag=0, v4map=0;
   sa_family_t family;
   struct in6_addr in6_tmp;
-  struct in_addr in_tmp;
+  struct in_addr in_tmp = { .s_addr = 0 };
 
   tor_assert(s);
   tor_assert(addr_out);
@@ -666,7 +665,7 @@ tor_addr_parse_mask_ports(const char *s,
     tor_addr_from_ipv4h(addr_out, 0);
     any_flag = 1;
   } else if (!strcmp(address, "*6") && (flags & TAPMP_EXTENDED_STAR)) {
-    static char nil_bytes[16] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 };
+    static char nil_bytes[16] = { [0]=0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 };
     family = AF_INET6;
     tor_addr_from_ipv6_bytes(addr_out, nil_bytes);
     any_flag = 1;



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