Better placement of memset() to prevent compiler warning under MSVC

This commit is contained in:
Paul Bakker 2014-07-11 11:40:35 +02:00
parent 695266cb51
commit 308a586477

View file

@ -113,8 +113,6 @@ int net_connect( int *fd, const char *host, int port )
struct sockaddr_in server_addr;
struct hostent *server_host;
memset( &server_addr, 0, sizeof( server_addr ) );
#if defined(_WIN32) || defined(_WIN32_WCE)
WSADATA wsaData;
@ -129,6 +127,8 @@ int net_connect( int *fd, const char *host, int port )
signal( SIGPIPE, SIG_IGN );
#endif
memset( &server_addr, 0, sizeof( server_addr ) );
if( ( server_host = gethostbyname( host ) ) == NULL )
return( POLARSSL_ERR_NET_UNKNOWN_HOST );
@ -160,8 +160,6 @@ int net_bind( int *fd, const char *bind_ip, int port )
int n, c[4];
struct sockaddr_in server_addr;
memset( &server_addr, 0, sizeof( server_addr ) );
#if defined(_WIN32) || defined(_WIN32_WCE)
WSADATA wsaData;
@ -176,6 +174,8 @@ int net_bind( int *fd, const char *bind_ip, int port )
signal( SIGPIPE, SIG_IGN );
#endif
memset( &server_addr, 0, sizeof( server_addr ) );
if( ( *fd = (int) socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
return( POLARSSL_ERR_NET_SOCKET_FAILED );