Add #ifdefs around #defines

In order to avoid redefinition warnings, check before we define.
This commit is contained in:
dkulwin 2015-11-04 18:48:22 -06:00
parent 5fd03ec459
commit 3bbefb6078

View File

@ -40,11 +40,13 @@ int WSHELPshutdown(int sfd, int how);
int WSHELPaccept(int sfd, struct sockaddr* addr, int* addrlen); int WSHELPaccept(int sfd, struct sockaddr* addr, int* addrlen);
int WSHELPselect (int sfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timeval *timeout); int WSHELPselect (int sfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timeval *timeout);
/* Other helpers */ /* Other helpers */
void WSHELPinitialize(); void WSHELPinitialize();
int map_standard_descriptor(int *fd); int map_standard_descriptor(int *fd);
void allocate_standard_descriptor(int fd); void allocate_standard_descriptor(int fd);
/* Redirect callers of socket functions to use our indirection functions */ /* Redirect callers of socket functions to use our indirection functions */
#if NEED_FUNC_MACROS #if NEED_FUNC_MACROS
#define isatty(sfd) WSHELPisatty(sfd) #define isatty(sfd) WSHELPisatty(sfd)
@ -127,30 +129,75 @@ int WSHELPclose(int sfd);
/* Errno helpers */ /* Errno helpers */
#ifndef ENETDOWN
#define ENETDOWN WSAENETDOWN #define ENETDOWN WSAENETDOWN
#endif
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT #define EAFNOSUPPORT WSAEAFNOSUPPORT
#endif
#ifndef EINPROGRESS
#define EINPROGRESS WSAEINPROGRESS #define EINPROGRESS WSAEINPROGRESS
#endif
#ifndef EXX
#define EXX WSAEMFILE #define EXX WSAEMFILE
#endif
#ifndef EXX1
#define EXX1 WSAENOBUFS #define EXX1 WSAENOBUFS
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE WSAEPROTOTYPE #define EPROTOTYPE WSAEPROTOTYPE
#endif
#ifndef ESOCKTNOSUPPORT
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT #define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
#endif
#ifndef EADDRINUSE
#define EADDRINUSE WSAEADDRINUSE #define EADDRINUSE WSAEADDRINUSE
// in errno.h #define EINVAL WSAEINVAL #endif
#ifndef EISCONN
#define EISCONN WSAEISCONN #define EISCONN WSAEISCONN
#endif
#ifndef ENOTSOCK
#define ENOTSOCK WSAENOTSOCK #define ENOTSOCK WSAENOTSOCK
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP WSAENOTSUPP #define EOPNOTSUPP WSAENOTSUPP
// in errno.h #define EINTR WSAEINTR #endif
#ifndef EALREADY
#define EALREADY WSAEALREADY #define EALREADY WSAEALREADY
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED WSAECONNREFUSED #define ECONNREFUSED WSAECONNREFUSED
// in errno.h #define EFAULT WSAEFAULT #endif
#ifndef ENOTUNREACH
#define ENOTUNREACH WSAENOTUNREACH #define ENOTUNREACH WSAENOTUNREACH
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH WSAEHOSTUNREACH #define EHOSTUNREACH WSAEHOSTUNREACH
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT WSAETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#endif
#ifndef EACCES
#define EACCES WSAEACCESS #define EACCES WSAEACCESS
#endif
#ifndef ECONNRESET
#define ECONNRESET WSAECONNRESET #define ECONNRESET WSAECONNRESET
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT WSAENOPROTOOPT #define ENOPROTOOPT WSAENOPROTOOPT
#endif
#ifndef EPFNOSUPPORT
#define EPFNOSUPPORT WSAEPFNOSUPPORT #define EPFNOSUPPORT WSAEPFNOSUPPORT
#endif
#ifndef ENOTCONN
#define ENOTCONN WSAENOTCONN #define ENOTCONN WSAENOTCONN
#endif #endif
#endif