Bug 1318979 - Suppress unused variable warnings in ptio.c, r=kaie
authorMartin Thomson <martin.thomson@gmail.com>
Mon, 21 Nov 2016 12:30:06 +1100
changeset 4710 8319f7a459dc64fd6d62e24381d114b460e9fb9d
parent 4709 b8ceb5cab1b2d6bc9dc188e9b2804fc6d6234bb1
child 4711 0835554ac65ebbf1875c37454f34f315fbb514a6
push id234
push usermartin.thomson@gmail.com
push dateThu, 16 Mar 2017 04:01:16 +0000
reviewerskaie
bugs1318979
Bug 1318979 - Suppress unused variable warnings in ptio.c, r=kaie
pr/src/pthreads/ptio.c
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -1537,33 +1537,36 @@ static PRStatus pt_Fsync(PRFileDesc *fd)
 
 static PRStatus pt_Connect(
     PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime timeout)
 {
     PRIntn rv = -1, syserrno;
     pt_SockLen addr_len;
 	const PRNetAddr *addrp = addr;
 #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6)
-	PRUint16 md_af = addr->raw.family;
     PRNetAddr addrCopy;
 #endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+    PRUint16 md_af = addr->raw.family;
+#endif
 
     if (pt_TestAbort()) return PR_FAILURE;
 
     PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
     addr_len = PR_NETADDR_SIZE(addr);
-#if defined(_PR_INET6)
-	if (addr->raw.family == PR_AF_INET6) {
-		md_af = AF_INET6;
-#ifndef _PR_HAVE_SOCKADDR_LEN
-		addrCopy = *addr;
-		addrCopy.raw.family = AF_INET6;
-		addrp = &addrCopy;
+#ifdef _PR_INET6
+    if (addr->raw.family == PR_AF_INET6) {
+#ifdef _PR_HAVE_SOCKADDR_LEN
+        md_af = AF_INET6;
+#else
+        addrCopy = *addr;
+        addrCopy.raw.family = AF_INET6;
+        addrp = &addrCopy;
 #endif
-	}
+    }
 #endif
 
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
     addrp = &addrCopy;
 #endif
@@ -1727,42 +1730,45 @@ failed:
 }  /* pt_Accept */
 
 static PRStatus pt_Bind(PRFileDesc *fd, const PRNetAddr *addr)
 {
     PRIntn rv;
     pt_SockLen addr_len;
 	const PRNetAddr *addrp = addr;
 #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6)
-	PRUint16 md_af = addr->raw.family;
     PRNetAddr addrCopy;
 #endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+    PRUint16 md_af = addr->raw.family;
+#endif
 
     if (pt_TestAbort()) return PR_FAILURE;
 
     PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
     if (addr->raw.family == AF_UNIX)
     {
         /* Disallow relative pathnames */
         if (addr->local.path[0] != '/')
         {
             PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0);
             return PR_FAILURE;
         }
     }
 
-#if defined(_PR_INET6)
-	if (addr->raw.family == PR_AF_INET6) {
-		md_af = AF_INET6;
-#ifndef _PR_HAVE_SOCKADDR_LEN
-		addrCopy = *addr;
-		addrCopy.raw.family = AF_INET6;
-		addrp = &addrCopy;
+#ifdef _PR_INET6
+    if (addr->raw.family == PR_AF_INET6) {
+#ifdef _PR_HAVE_SOCKADDR_LEN
+        md_af = AF_INET6;
+#else
+        addrCopy = *addr;
+        addrCopy.raw.family = AF_INET6;
+        addrp = &addrCopy;
 #endif
-	}
+    }
 #endif
 
     addr_len = PR_NETADDR_SIZE(addr);
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
     addrp = &addrCopy;
@@ -1984,32 +1990,35 @@ static PRInt32 pt_SendTo(
     PRInt32 amount, PRIntn flags, const PRNetAddr *addr,
     PRIntervalTime timeout)
 {
     PRInt32 syserrno, bytes = -1;
     PRBool fNeedContinue = PR_FALSE;
     pt_SockLen addr_len;
 	const PRNetAddr *addrp = addr;
 #if defined(_PR_HAVE_SOCKADDR_LEN) || defined(_PR_INET6)
-	PRUint16 md_af = addr->raw.family;
     PRNetAddr addrCopy;
 #endif
+#ifdef _PR_HAVE_SOCKADDR_LEN
+    PRUint16 md_af = addr->raw.family;
+#endif
 
     if (pt_TestAbort()) return bytes;
 
     PR_ASSERT(IsValidNetAddr(addr) == PR_TRUE);
-#if defined(_PR_INET6)
-	if (addr->raw.family == PR_AF_INET6) {
-		md_af = AF_INET6;
-#ifndef _PR_HAVE_SOCKADDR_LEN
-		addrCopy = *addr;
-		addrCopy.raw.family = AF_INET6;
-		addrp = &addrCopy;
+#ifdef _PR_INET6
+    if (addr->raw.family == PR_AF_INET6) {
+#ifdef _PR_HAVE_SOCKADDR_LEN
+        md_af = AF_INET6;
+#else
+        addrCopy = *addr;
+        addrCopy.raw.family = AF_INET6;
+        addrp = &addrCopy;
 #endif
-	}
+    }
 #endif
 
     addr_len = PR_NETADDR_SIZE(addr);
 #ifdef _PR_HAVE_SOCKADDR_LEN
     addrCopy = *addr;
     ((struct sockaddr*)&addrCopy)->sa_len = addr_len;
     ((struct sockaddr*)&addrCopy)->sa_family = md_af;
     addrp = &addrCopy;