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
This commit is contained in:
Dan Winship
2013-10-19 13:04:00 -04:00
parent 3981cddbf8
commit 158dde0507
48 changed files with 66 additions and 152 deletions

View File

@@ -23,9 +23,6 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
@@ -36,6 +33,9 @@
#include <glib.h>
#include <glib/gprintf.h>
#ifdef G_OS_UNIX
#include <unistd.h>
#endif
#ifdef G_OS_WIN32
#include <io.h>
#endif

View File

@@ -21,9 +21,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>