some annoying compilers warn about "(void)foo;" lines so we avoid them

This commit is contained in:
Daniel Stenberg 2004-02-09 08:34:19 +00:00
parent cc85f813d1
commit 3bdc883c93

View File

@ -223,7 +223,6 @@ static CURLcode bindlocal(struct connectdata *conn,
* Select device to bind socket to * Select device to bind socket to
*************************************************************/ *************************************************************/
if (strlen(data->set.device)<255) { if (strlen(data->set.device)<255) {
struct sockaddr_in sa;
struct Curl_dns_entry *h=NULL; struct Curl_dns_entry *h=NULL;
size_t size; size_t size;
char myhost[256] = ""; char myhost[256] = "";
@ -282,7 +281,6 @@ static CURLcode bindlocal(struct connectdata *conn,
/* we don't need it anymore after this function has returned */ /* we don't need it anymore after this function has returned */
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
(void)sa; /* prevent compiler warning */
if( bind(sockfd, addr->ai_addr, addr->ai_addrlen) >= 0) { if( bind(sockfd, addr->ai_addr, addr->ai_addrlen) >= 0) {
/* we succeeded to bind */ /* we succeeded to bind */
struct sockaddr_in6 add; struct sockaddr_in6 add;
@ -295,6 +293,9 @@ static CURLcode bindlocal(struct connectdata *conn,
} }
} }
#else #else
{
struct sockaddr_in sa;
memset((char *)&sa, 0, sizeof(sa)); memset((char *)&sa, 0, sizeof(sa));
memcpy((char *)&sa.sin_addr, addr->h_addr, addr->h_length); memcpy((char *)&sa.sin_addr, addr->h_addr, addr->h_length);
sa.sin_family = AF_INET; sa.sin_family = AF_INET;
@ -312,6 +313,7 @@ static CURLcode bindlocal(struct connectdata *conn,
return CURLE_HTTP_PORT_FAILED; return CURLE_HTTP_PORT_FAILED;
} }
} }
}
#endif #endif
else { else {
switch(errno) { switch(errno) {