Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: ed67b2b07f
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (35 sloc) 0.715 kB
#ifndef compatibility_h_
#define compatibility_h_
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include "gol.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
typedef char sockopt_t;
typedef int socklen_t;
# ifndef strncasecmp
# define strncasecmp strnicmp
# endif
GOL_INLINE char*
strndup(const char* src, size_t n) {
const size_t srclen = strlen(src);
n = n < srclen ? n : srclen;
char* ptr = (char*) malloc(n + 1);
*(ptr + n) = 0;
memcpy(ptr, src, n);
return ptr;
}
#else // _WIN32
# define closesocket(x) close(x)
typedef int sockopt_t;
# ifndef SD_BOTH
# define SD_BOTH SHUT_RDWR
# endif
#endif // _WIN32
#ifdef __cplusplus
}
#endif
#endif // compatibility_h_
Jump to Line
Something went wrong with that request. Please try again.