libmemcached-1.0: fix #57 (cinttypes/inttypes.h)
[awesomized/libmemcached] / win32 / wrappers.h
index 80b44651c4b29aa8162f8d48a3f982a442077c41..5bf325e9b31f68d431d1d30aa27370a17417acc3 100644 (file)
@@ -9,8 +9,7 @@
  *          to avoid a bunch of ifdefs in the rest of the code
  *
  */
-#ifndef WIN32_WRAPPERS_H
-#define WIN32_WRAPPERS_H 1
+#pragma once 
 
 #include <inttypes.h>
 
  * WinSock use a separate range for error codes. Let's just map to the
  * WinSock ones.
  */
-#define EADDRINUSE WSAEADDRINUSE
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#define EINPROGRESS WSAEINPROGRESS
-#define EALREADY WSAEALREADY
-#define EISCONN WSAEISCONN
-#define ENOTCONN WSAENOTCONN
-#define ENOBUFS WSAENOBUFS
-#define SHUT_RDWR SD_BOTH
+#ifndef EADDRINUSE
+# define EADDRINUSE WSAEADDRINUSE
+#endif
+
+#ifndef EWOULDBLOCK
+# define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
+
+#ifndef EINPROGRESS
+# define EINPROGRESS WSAEINPROGRESS
+#endif
+
+#ifndef EALREADY
+# define EALREADY WSAEALREADY
+#endif
+
+#ifndef EISCONN
+# define EISCONN WSAEISCONN
+#endif
+
+#ifndef ENOTCONN
+# define ENOTCONN WSAENOTCONN
+#endif
+
+#ifndef ENOBUFS
+# define ENOBUFS WSAENOBUFS
+#endif
+
+#ifndef SHUT_RDWR
+# define SHUT_RDWR SD_BOTH
+#endif
 
 /* EAI_SYSTEM isn't defined anywhere... just set it to... 11? */
-#define EAI_SYSTEM 11
+#ifndef EAI_SYSTEM
+# define EAI_SYSTEM 11
+#endif
 
 /* Best effort mapping of functions to alternative functions */
 #define index(a,b) strchr(a,b)
@@ -51,5 +75,3 @@
 #define waitpid(a,b,c) (-1)
 #define fnmatch(a,b,c) (-1)
 #define sleep(a) Sleep(a*1000)
-
-#endif /* WIN32_WRAPPERS_H */