Redo socklen_t on Windows without including <ws2tcpip.h>

This commit is contained in:
Boris Kolpackov 2022-09-05 18:23:20 +02:00
parent a9944ed041
commit 013bbe243d

View File

@ -22,8 +22,13 @@
# include <sys/socket.h> # include <sys/socket.h>
/* If available, we do nothing. */ /* If available, we do nothing. */
# elif defined(_WIN32) # elif defined(_WIN32)
# include <ws2tcpip.h> /* While socklen_t is declared in <ws2tcpip.h>, including this header is
/* If available, we do nothing. */ * hazardous due to it being sensitive to WIN32_LEAN_AND_MEAN (and who
* knows what else). At the same time, in both Platform SDK and MinGW,
* this is a simple int typedef and so just doing that feels like the
* simplest (if hackish) way to sidestep the whole mess.
*/
typedef int socklen_t;
# else # else
/* Else define it to unsigned int (suggested fallback by libevent). */ /* Else define it to unsigned int (suggested fallback by libevent). */
# define socklen_t unsigned int # define socklen_t unsigned int