diff options
author | Dan Winship <danw@gnome.org> | 2013-10-19 13:04:00 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-11-20 09:25:39 -0500 |
commit | 158dde050702f83a058962d14156a02234fc9685 (patch) | |
tree | 73f8f1cc846447ca50cd92b3d58144fff818febe /tests | |
parent | 3981cddbf8659458be9f863151314cd0fd1682bf (diff) |
Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.
Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.
https://bugzilla.gnome.org/show_bug.cgi?id=710519
Diffstat (limited to 'tests')
-rw-r--r-- | tests/env-test.c | 4 | ||||
-rw-r--r-- | tests/file-test.c | 5 | ||||
-rw-r--r-- | tests/gio-test.c | 8 |
3 files changed, 6 insertions, 11 deletions
diff --git a/tests/env-test.c b/tests/env-test.c index b75eb4250..1b2e2193b 100644 --- a/tests/env-test.c +++ b/tests/env-test.c @@ -37,10 +37,6 @@ #include <glib.h> -#ifdef G_OS_UNIX -#include <unistd.h> -#endif - int main (int argc, char *argv[]) { diff --git a/tests/file-test.c b/tests/file-test.c index 6c8d2076b..ce958d53f 100644 --- a/tests/file-test.c +++ b/tests/file-test.c @@ -37,12 +37,11 @@ #include <gstdio.h> +#include <fcntl.h> /* For open() */ + #ifdef G_OS_UNIX #include <unistd.h> #endif - -#include <fcntl.h> /* For open() */ - #ifdef G_OS_WIN32 #include <io.h> /* For read(), write() etc */ #endif diff --git a/tests/gio-test.c b/tests/gio-test.c index 06c385cc5..fd4ffe03d 100644 --- a/tests/gio-test.c +++ b/tests/gio-test.c @@ -40,10 +40,10 @@ #define STRICT #include <windows.h> #define pipe(fds) _pipe(fds, 4096, _O_BINARY) -#else - #ifdef HAVE_UNISTD_H - #include <unistd.h> - #endif +#endif + +#ifdef G_OS_UNIX + #include <unistd.h> #endif static int nrunning; |