diff --git a/c/bitvector-ops.c b/c/bitvector-ops.c index 2808752..4325aca 100644 --- a/c/bitvector-ops.c +++ b/c/bitvector-ops.c @@ -3,9 +3,8 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include -#define alloca _alloca #endif #include "dtypes.h" diff --git a/c/bitvector.c b/c/bitvector.c index 3df9a13..340fe14 100644 --- a/c/bitvector.c +++ b/c/bitvector.c @@ -34,13 +34,13 @@ #include #include -#include "dtypes.h" -#include "bitvector.h" - -#ifdef WIN32 +#ifdef _WIN32 #include #endif +#include "dtypes.h" +#include "bitvector.h" + uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz, int initzero) { diff --git a/c/builtins.c b/c/builtins.c index 732e0cc..cbb2885 100644 --- a/c/builtins.c +++ b/c/builtins.c @@ -345,7 +345,7 @@ static value_t fl_path_cwd(value_t *args, uint32_t nargs) return FL_T; } -#ifdef WIN32 +#ifdef _WIN32 #define stat _stat #endif static value_t fl_path_exists(value_t *args, uint32_t nargs) diff --git a/c/dtypes.h b/c/dtypes.h index d38f484..4c277ac 100644 --- a/c/dtypes.h +++ b/c/dtypes.h @@ -13,24 +13,10 @@ We assume the LP64 convention for 64-bit platforms. */ -#if defined(__gnu_linux__) -#define LINUX -#elif defined(__APPLE__) && defined(__MACH__) -#define MACOSX -#elif defined(__OpenBSD__) -#define OPENBSD -#elif defined(__FreeBSD__) -#define FREEBSD -#elif defined(_WIN32) -#define WIN32 -#else -#error "unknown platform" -#endif - #undef BITS32 // TODO #define BITS64 // TODO -#if defined(WIN32) +#ifdef _WIN32 #define STDCALL __stdcall #if defined(IMPORT_EXPORTS) #define DLLEXPORT __declspec(dllimport) diff --git a/c/flisp.c b/c/flisp.c index 3cb3cfd..6245691 100644 --- a/c/flisp.c +++ b/c/flisp.c @@ -2624,7 +2624,7 @@ static void lisp_init(size_t initial_heapsize) #ifdef LINUX set(symbol("*os-name*"), symbol("linux")); -#elif defined(WIN32) || defined(WIN64) +#elif defined(_WIN32) set(symbol("*os-name*"), symbol("win32")); #elif defined(MACOSX) set(symbol("*os-name*"), symbol("macos")); diff --git a/c/ios.c b/c/ios.c index 1ff2944..b326f03 100644 --- a/c/ios.c +++ b/c/ios.c @@ -9,7 +9,7 @@ #include "dtypes.h" -#ifdef WIN32 +#ifdef _WIN32 #include #include #include @@ -43,7 +43,7 @@ static void *our_memrchr(const void *s, int c, size_t n) // poll for read, unless forwrite!=0 static void _fd_poll(long fd, int forwrite) { -#ifndef WIN32 +#ifndef _WIN32 fd_set set; FD_ZERO(&set); diff --git a/c/socket.c b/c/socket.c index fb251ab..f438fe0 100644 --- a/c/socket.c +++ b/c/socket.c @@ -107,7 +107,7 @@ int open_any_udp_port(short *portno) return sockfd; } -#ifndef WIN32 +#ifndef _WIN32 void closesocket(int fd) { close(fd); } #endif diff --git a/c/socket.h b/c/socket.h index 3604fe4..6477ea3 100644 --- a/c/socket.h +++ b/c/socket.h @@ -1,4 +1,4 @@ -#ifdef WIN32 +#ifdef _WIN32 #include #else #include @@ -8,6 +8,10 @@ #include #endif +#ifndef _WIN32 +void closesocket(int fd); +#endif + int open_tcp_port(short portno); int open_any_tcp_port(short *portno); int open_any_udp_port(short *portno); @@ -17,7 +21,3 @@ int sendall(int sockfd, char *buffer, int bufLen, int flags); int readall(int sockfd, char *buffer, int bufLen, int flags); int addr_eq(struct sockaddr_in *a, struct sockaddr_in *b); int socket_ready(int sock); - -#ifndef WIN32 -void closesocket(int fd); -#endif diff --git a/c/utf8.c b/c/utf8.c index 67ff22c..336d866 100644 --- a/c/utf8.c +++ b/c/utf8.c @@ -23,7 +23,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #define snprintf _snprintf #endif @@ -253,7 +253,7 @@ size_t u8_strlen(const char *s) return count; } -#if defined(__WIN32__) +#ifdef _WIN32 #include "wcwidth.h" #endif diff --git a/c/utf8.h b/c/utf8.h index c534e4e..f1c852b 100644 --- a/c/utf8.h +++ b/c/utf8.h @@ -1,6 +1,6 @@ extern int locale_is_utf8; -#if defined(__WIN32__) +#ifdef _WIN32 extern int wcwidth(uint32_t); #endif