Unify preprocessor checks for win32
<https://sourceforge.net/p/predef/wiki/OperatingSystems/> says that _WIN32 is always defined for both 32-bit and 64-bit versions of Windows.
This commit is contained in:
parent
267cd00146
commit
e9d6ca265c
|
@ -3,9 +3,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#define alloca _alloca
|
||||
#endif
|
||||
|
||||
#include "dtypes.h"
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "dtypes.h"
|
||||
#include "bitvector.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "dtypes.h"
|
||||
#include "bitvector.h"
|
||||
|
||||
uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz,
|
||||
int initzero)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
16
c/dtypes.h
16
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)
|
||||
|
|
|
@ -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"));
|
||||
|
|
4
c/ios.c
4
c/ios.c
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "dtypes.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -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);
|
||||
|
|
|
@ -107,7 +107,7 @@ int open_any_udp_port(short *portno)
|
|||
return sockfd;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef _WIN32
|
||||
void closesocket(int fd) { close(fd); }
|
||||
#endif
|
||||
|
||||
|
|
10
c/socket.h
10
c/socket.h
|
@ -1,4 +1,4 @@
|
|||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
|
@ -8,6 +8,10 @@
|
|||
#include <fcntl.h>
|
||||
#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
|
||||
|
|
4
c/utf8.c
4
c/utf8.c
|
@ -23,7 +23,7 @@
|
|||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#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
|
||||
|
||||
|
|
Loading…
Reference in New Issue