Add ssize_t (GH PR #40)

This commit is contained in:
Fred Helmesjö 2022-09-01 10:49:48 +02:00 committed by Boris Kolpackov
parent 94fad53de9
commit 49a03ff46f

View File

@ -0,0 +1,27 @@
// ssize_t : BUILD2_AUTOCONF_LIBC_VERSION
#ifndef BUILD2_AUTOCONF_LIBC_VERSION
# error BUILD2_AUTOCONF_LIBC_VERSION appears to be conditionally included
#endif
#undef ssize_t
/* POSIX and MinGW (which also has <sys/types.h> that defines ssize_t).
*/
#if defined(__linux__) || \
defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
defined(__NetBSD__) || \
defined(BUILD2_AUTOCONF_MACOS) || \
defined(__MINGW32__) || \
(defined(__sun) && defined(__SVR4)) || \
defined(__CYGWIN__)
# include <sys/types.h>
/* If available, we do nothing. */
#elif defined(_WIN32)
# include <basetsd.h>
typedef SSIZE_T ssize_t;
#else
/* Else define it to int (suggested fallback by libevent). */
# define ssize_t int
#endif