changeset 191:cc5411cb85de

Use TH_PLAT_WINDOWS define for #ifdef logic.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 11 Feb 2016 16:09:12 +0200
parents c65ee8808381
children 7d25d43a3ce2
files th_network.c th_network.h
diffstat 2 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/th_network.c	Thu Feb 11 16:08:12 2016 +0200
+++ b/th_network.c	Thu Feb 11 16:09:12 2016 +0200
@@ -232,7 +232,7 @@
 
     for (status = TH_CONN_NO_DATA, tries = 1; tries <= 20 && status != TH_CONN_DATA_AVAIL; tries++)
     {
-#ifdef __WIN32
+#ifdef TH_PLAT_WINDOWS
         Sleep(100);
 #else
         usleep(100000);
@@ -681,7 +681,7 @@
 
     if (conn->base.socket >= 0)
     {
-#ifdef __WIN32
+#ifdef TH_PLAT_WINDOWS
         closesocket(conn->base.socket);
 #else
         close(conn->base.socket);
@@ -839,7 +839,7 @@
 
 int th_network_init(void)
 {
-#ifdef __WIN32
+#ifdef TH_PLAT_WINDOWS
     // Initialize WinSock, if needed
     WSADATA wsaData;
     int err = WSAStartup(0x0101, &wsaData);
@@ -871,7 +871,7 @@
             curr = next;
         }
         
-#ifdef __WIN32
+#ifdef TH_PLAT_WINDOWS
         WSACleanup();
 #endif
     }
--- a/th_network.h	Thu Feb 11 16:08:12 2016 +0200
+++ b/th_network.h	Thu Feb 11 16:09:12 2016 +0200
@@ -14,20 +14,20 @@
 #include "th_util.h"
 
 
-#ifdef __WIN32
-#define __OBJC_BOOL // A nasty hack
-#include <windows.h>
-#include <winsock.h>
+#ifdef TH_PLAT_WINDOWS
+#    define __OBJC_BOOL // A nasty hack
+#    include <windows.h>
+#    include <winsock.h>
 typedef uint16_t in_port_t;
 typedef uint32_t in_addr_t;
 #else
-#include <sys/select.h>
-#include <sys/socket.h>
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#include <arpa/inet.h>
-#include <netdb.h>
+#    include <sys/select.h>
+#    include <sys/socket.h>
+#    ifdef HAVE_NETINET_IN_H
+#        include <netinet/in.h>
+#    endif
+#    include <arpa/inet.h>
+#    include <netdb.h>
 #endif