summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Perez de Castro <aperez@igalia.com>2019-08-05 13:52:18 +0300
committerRan Benita <ran234@gmail.com>2019-12-28 16:12:15 +0200
commit5354dee2f7ee99792a38a3a13f85da90c654f7ee (patch)
treed815208aba67ffc6bf4d9e0fe64c6e13396a639a /test
parentf09ae987bffc2ede00341bc6f0e903ae6810def5 (diff)
downloadxorg-lib-libxkbcommon-5354dee2f7ee99792a38a3a13f85da90c654f7ee.tar.gz
MSVC: Use <io.h> as an alternative for <unistd.h>
Only the input/output functions from <unistd.h> options are used, so using <io.h> when building with MSVC should be enough. The inclusion of the header in context-priv.c does not seem to be needed (tested on GNU/Linux) and so it is removed. Signed-off-by: Ran Benita <ran@unusedvar.com>
Diffstat (limited to 'test')
-rw-r--r--test/common.c4
-rw-r--r--test/context.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/test/common.c b/test/common.c
index 3784d8b..446ce58 100644
--- a/test/common.c
+++ b/test/common.c
@@ -34,7 +34,11 @@
#include <limits.h>
#include <fcntl.h>
+#ifdef _MSC_VER
+#include <io.h>
+#else
#include <unistd.h>
+#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
diff --git a/test/context.c b/test/context.c
index 13d47a1..2f5fd37 100644
--- a/test/context.c
+++ b/test/context.c
@@ -30,7 +30,15 @@
#include <sys/stat.h>
#include <sys/types.h>
-#include <unistd.h>
+#ifdef _MSC_VER
+# include <io.h>
+# include <direct.h>
+# ifndef S_ISDIR
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+# endif
+#else
+# include <unistd.h>
+#endif
/* keeps a cache of all makedir/maketmpdir directories so we can free and
* rmdir them in one go, see unmakedirs() */