Rename PLATFORM macro to "namespace" UDPC_

This commit is contained in:
Stephen Seo 2019-01-26 16:49:54 +09:00
parent 909fe2e744
commit bc79efa20f
2 changed files with 12 additions and 12 deletions

View file

@ -37,11 +37,11 @@ UDPC_Context UDPC_init(unsigned short listenPort)
}
// set nonblocking on socket
#if PLATFORM == PLATFORM_MAC || PLATFORM == PLATFORM_LINUX
#if UDPC_PLATFORM == UDPC_PLATFORM_MAC || UDPC_PLATFORM == UDPC_PLATFORM_LINUX
int nonblocking = 1;
if(fcntl(context.socketHandle, F_SETFL, O_NONBLOCK, nonblocking) == -1)
{
#elif PLATFORM == PLATFORM_WINDOWS
#elif UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
DWORD nonblocking = 1;
if(ioctlsocket(context.socketHandle, FIONBIO, &nonblocking) != 0)
{

View file

@ -4,26 +4,26 @@
#include <stdio.h>
#include <threads.h>
#define PLATFORM_WINDOWS 1
#define PLATFORM_MAC 2
#define PLATFORM_LINUX 3
#define PLATFORM_UNKNOWN 0
#define UDPC_PLATFORM_WINDOWS 1
#define UDPC_PLATFORM_MAC 2
#define UDPC_PLATFORM_LINUX 3
#define UDPC_PLATFORM_UNKNOWN 0
#if defined _WIN32
#define PLATFORM PLATFORM_WINDOWS
#define UDPC_PLATFORM UDPC_PLATFORM_WINDOWS
#elif defined __APPLE__
#define PLATFORM PLATFORM_MAC
#define UDPC_PLATFORM UDPC_PLATFORM_MAC
#elif defined __linux__
#define PLATFORM PLATFORM_LINUX
#define UDPC_PLATFORM UDPC_PLATFORM_LINUX
#else
#define PLATFORM PLATFORM_UNKNOWN
#define UDPC_PLATFORM UDPC_PLATFORM_UNKNOWN
#endif
#if PLATFORM == PLATFORM_WINDOWS
#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
#include <winsock2.h>
#define CleanupSocket(x) closesocket(x)
#elif PLATFORM == PLATFORM_MAC || PLATFORM == PLATFORM_LINUX
#elif UDPC_PLATFORM == UDPC_PLATFORM_MAC || UDPC_PLATFORM == UDPC_PLATFORM_LINUX
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>