SOCKET: Include system include files prior to referencing macros that they may define.

Fix #302
This commit is contained in:
Mark Pizzolato 2016-04-12 13:08:31 -07:00
parent 5a5df503af
commit 14d1c4e2da

View file

@ -50,6 +50,18 @@
#include <winsock2.h>
#elif !defined (__OS2__) || defined (__EMX__) /* VMS, Mac, Unix, OS/2 EMX */
#include <sys/types.h> /* for fcntl, getpid */
#include <sys/socket.h> /* for sockets */
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <netinet/in.h> /* for sockaddr_in */
#include <netinet/tcp.h> /* for TCP_NODELAY */
#include <arpa/inet.h> /* for inet_addr and inet_ntoa */
#include <netdb.h>
#include <sys/time.h> /* for EMX */
#define WSAGetLastError() errno /* Windows macros */
#define WSASetLastError(err) errno = err
#define closesocket close
@ -75,24 +87,10 @@
#define WSAEINTR EINTR
#define INVALID_SOCKET ((SOCKET)-1)
#define SOCKET_ERROR -1
#include <sys/types.h> /* for fcntl, getpid */
#include <sys/socket.h> /* for sockets */
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <netinet/in.h> /* for sockaddr_in */
#include <netinet/tcp.h> /* for TCP_NODELAY */
#include <arpa/inet.h> /* for inet_addr and inet_ntoa */
#include <netdb.h>
#include <sys/time.h> /* for EMX */
#endif
#if defined (VMS) /* VMS unique */
#include <ioctl.h> /* for ioctl */
#if !defined (timerclear)
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif
#if !defined (AI_NUMERICHOST)
#define AI_NUMERICHOST 0
#endif
@ -100,11 +98,6 @@
#define sockaddr_storage sockaddr
#endif
#endif
#if defined(__EMX__) /* OS/2 unique */
#if !defined (timerclear)
#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
#endif
#endif
#if !defined(CBUFSIZE)
#define CBUFSIZE 1024