diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-11-06 19:20:37 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-11-07 21:52:23 +0000 |
commit | 0162e54075bb7ad967a85736b3c8addd53d86de5 (patch) | |
tree | 8a621af4c54f0d11b610b6842c9f53aae849e68a /wsutil | |
parent | 24bfb7e35d619c004e0458f38a1d5ae538a898fb (diff) |
Clean up includes of unistd.h, fcntl.h, and sys/stat.h.
Have wsutil/file_util.h include them on UN*X, just as it includes io.h
on Windows, so we can have a rule of "if you do file operations, include
<wsutil/file_util.h> and use the routines in it".
Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't
necessary (whether because of the addition of them to wsutil/file_util.h
or because they weren't needed in the first place).
Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f
Reviewed-on: https://code.wireshark.org/review/11619
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/file_util.h | 20 | ||||
-rw-r--r-- | wsutil/filesystem.c | 12 | ||||
-rw-r--r-- | wsutil/plugins.c | 4 | ||||
-rw-r--r-- | wsutil/tempfile.c | 8 | ||||
-rw-r--r-- | wsutil/u3.c | 6 |
5 files changed, 14 insertions, 36 deletions
diff --git a/wsutil/file_util.h b/wsutil/file_util.h index 833518a9bc..dff51bbe83 100644 --- a/wsutil/file_util.h +++ b/wsutil/file_util.h @@ -32,12 +32,20 @@ extern "C" { #include <glib.h> #ifdef _WIN32 -#include <io.h> +#include <io.h> /* for _read(), _write(), etc. */ #include <gmodule.h> #endif +#ifdef HAVE_FCNTL_H +#include <fcntl.h> /* for open() */ +#endif + +#ifdef HAVE_UNISTD_H +#include <unistd.h> /* for read(), write(), close(), etc. */ +#endif + #ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> +#include <sys/stat.h> /* for stat() and struct stat */ #endif /* @@ -59,6 +67,8 @@ extern "C" { #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #endif +#include <stdio.h> + #ifdef _WIN32 /* @@ -81,8 +91,6 @@ extern "C" { * removing the target if necessary. */ -#include <stdio.h> - WS_DLL_PUBLIC int ws_stdio_open (const gchar *filename, int flags, int mode); WS_DLL_PUBLIC int ws_stdio_rename (const gchar *oldfilename, const gchar *newfilename); WS_DLL_PUBLIC int ws_stdio_mkdir (const gchar *filename, int mode); @@ -192,9 +200,7 @@ WS_DLL_PUBLIC void create_app_running_mutex(); #define ws_dir_rewind g_dir_rewind #define ws_dir_close g_dir_close -/* XXX - remove include "dirent.h" */ -/* XXX - remove include "direct.h" */ -/* XXX - remove include "sys/stat.h" */ +/* XXX - remove include "sys/stat.h" from files that include this header */ /* XXX - update docs (e.g. README.developer) */ #ifdef __cplusplus diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index efa5f34041..787ad6ebb4 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -36,18 +36,6 @@ #include <glib.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - #ifdef _WIN32 #include <windows.h> #include <tchar.h> diff --git a/wsutil/plugins.c b/wsutil/plugins.c index ab15a1809a..ac3687dff1 100644 --- a/wsutil/plugins.c +++ b/wsutil/plugins.c @@ -31,10 +31,6 @@ #include <string.h> #include <errno.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - #include <glib.h> #include <gmodule.h> diff --git a/wsutil/tempfile.c b/wsutil/tempfile.c index 93bd66fe7a..4be05f8b84 100644 --- a/wsutil/tempfile.c +++ b/wsutil/tempfile.c @@ -26,14 +26,6 @@ #include <stdlib.h> #include <errno.h> -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - #ifdef HAVE_WINDOWS_H #include <windows.h> #endif diff --git a/wsutil/u3.c b/wsutil/u3.c index 7d6493659c..04c1c28878 100644 --- a/wsutil/u3.c +++ b/wsutil/u3.c @@ -31,11 +31,7 @@ #include <string.h> #ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef HAVE_FCNTL_H -#include <fcntl.h> +#include <unistd.h> /* getpid */ #endif #ifdef _WIN32 |