From: Simon Tatham Date: Wed, 5 Feb 2014 21:51:25 +0000 (+0000) Subject: Revert half of r10135, and re-fix properly. X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=f4e7f26e7495072564d484b7b998914bcba2097b;p=PuTTY_svn.git Revert half of r10135, and re-fix properly. One of my changes in uxnet.c was outside the NO_IPV6 ifdef, and broke compilation in the normal mode. Revert all changes in that file and replace with a reference to the 'step' parameter in the no-IPv6 version of the SOCKADDR_FAMILY macro, so that those warnings are squelched anyway. git-svn-id: http://svn.tartarus.org/sgt/putty@10136 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/unix/uxnet.c b/unix/uxnet.c index 4d796f5d..c3002e43 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -126,9 +126,12 @@ struct SockAddr_tag { (addr)->superfamily == UNIX ? AF_UNIX : \ (step).ai ? (step).ai->ai_family : AF_INET) #else +/* Here we gratuitously reference 'step' to avoid gcc warnings about + * 'set but not used' when compiling -DNO_IPV6 */ #define SOCKADDR_FAMILY(addr, step) \ ((addr)->superfamily == UNRESOLVED ? AF_UNSPEC : \ - (addr)->superfamily == UNIX ? AF_UNIX : AF_INET) + (addr)->superfamily == UNIX ? AF_UNIX : \ + (step).curraddr ? AF_INET : AF_INET) #endif /* @@ -331,7 +334,9 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen) } #else struct in_addr a; - assert(SOCKADDR_FAMILY(addr, ignored_macro_parameter) == AF_INET); + SockAddrStep step; + START_STEP(addr, step); + assert(SOCKADDR_FAMILY(addr, step) == AF_INET); a.s_addr = htonl(addr->addresses[0]); strncpy(buf, inet_ntoa(a), buflen); buf[buflen-1] = '\0'; @@ -386,7 +391,9 @@ int sk_address_is_local(SockAddr addr) return sockaddr_is_loopback(addr->ais->ai_addr); #else struct in_addr a; - assert(SOCKADDR_FAMILY(addr, ignored_macro_parameter) == AF_INET); + SockAddrStep step; + START_STEP(addr, step); + assert(SOCKADDR_FAMILY(addr, step) == AF_INET); a.s_addr = htonl(addr->addresses[0]); return ipv4_is_loopback(a); #endif @@ -400,8 +407,10 @@ int sk_address_is_special_local(SockAddr addr) int sk_addrtype(SockAddr addr) { + SockAddrStep step; int family; - family = SOCKADDR_FAMILY(addr, ignored_macro_parameter); + START_STEP(addr, step); + family = SOCKADDR_FAMILY(addr, step); return (family == AF_INET ? ADDRTYPE_IPV4 : #ifndef NO_IPV6