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>
This commit is contained in:
Guy Harris 2015-11-06 19:20:37 -08:00
parent 24bfb7e35d
commit 0162e54075
52 changed files with 14 additions and 313 deletions

View File

@ -29,14 +29,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <signal.h>
#ifdef _WIN32

View File

@ -63,10 +63,6 @@
#include <locale.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

View File

@ -31,10 +31,6 @@
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#include "capture_opts.h"

View File

@ -25,7 +25,6 @@
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <stdarg.h>
#include "conditions.h"
#include "capture_stop_conditions.h"

View File

@ -32,10 +32,6 @@
#include <locale.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

View File

@ -39,18 +39,6 @@
#include <netinet/in.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

View File

@ -65,10 +65,6 @@
* a separate thread, making it, in effect, asynchronous.
*/
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif

View File

@ -26,10 +26,6 @@
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#include <wsutil/filesystem.h>

View File

@ -40,10 +40,6 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <epan/packet.h>
#include <epan/exceptions.h>
#include <epan/prefs.h>

View File

@ -94,10 +94,6 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/exceptions.h>

View File

@ -26,10 +26,6 @@
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#include <stdio.h>

8
file.c
View File

@ -22,10 +22,6 @@
#include <config.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <time.h>
#include <stdlib.h>
@ -34,10 +30,6 @@
#include <ctype.h>
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <wsutil/tempfile.h>
#include <wsutil/file_util.h>
#include <wsutil/filesystem.h>

View File

@ -22,18 +22,6 @@
#include <config.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 HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif

View File

@ -30,10 +30,6 @@
#include <errno.h>
#include <glib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@ -60,10 +56,6 @@
#include <wiretap/merge.h>
#include <wiretap/pcap-encap.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef _WIN32
#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */

View File

@ -26,10 +26,6 @@
#define __AVP_H_
#include "epan/proto.h"
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
/* #define _AVP_DEBUGGING */

View File

@ -23,10 +23,6 @@
#include <config.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@ -35,10 +31,6 @@
#include "wsutil/wsgetopt.h"
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <time.h>
#include <errno.h>

View File

@ -40,24 +40,12 @@
#include <locale.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifndef HAVE_GETOPT_LONG
#include "wsutil/wsgetopt.h"
#endif

View File

@ -28,10 +28,6 @@
#include <string.h>
#include <glib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

View File

@ -44,14 +44,6 @@
#ifdef HAVE_LIBPCAP
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <string.h>
#include <time.h>

View File

@ -118,10 +118,6 @@
#include <time.h>
#include <glib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

View File

@ -29,24 +29,12 @@
#include <locale.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif

View File

@ -30,28 +30,16 @@
#include <locale.h>
#include <limits.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
#include <errno.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifndef _WIN32
#include <signal.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h> /* to get the libz version number */
#endif

View File

@ -24,10 +24,6 @@
#ifdef HAVE_LIBPCAP
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -27,10 +27,6 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>

View File

@ -26,14 +26,6 @@
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <epan/packet_info.h>

View File

@ -26,10 +26,6 @@
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#include <wsutil/file_util.h>

View File

@ -22,10 +22,6 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <gtk/gtk.h>

View File

@ -26,14 +26,6 @@
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <wsutil/file_util.h>
#include <wsutil/str_util.h>

View File

@ -24,10 +24,6 @@
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <gtk/gtk.h>
#include <wsutil/filesystem.h>

View File

@ -36,14 +36,6 @@
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <epan/packet.h>

View File

@ -23,9 +23,6 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <gtk/gtk.h>

View File

@ -25,10 +25,6 @@
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <epan/follow.h>

View File

@ -38,14 +38,6 @@
#include <string.h>
#include <locale.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <gtk/gtk.h>
#include <wsutil/file_util.h>

View File

@ -36,10 +36,6 @@
#include <string.h>
#include <locale.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

View File

@ -25,14 +25,6 @@
#include "config.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#if GTK_CHECK_VERSION(3,0,0)

View File

@ -37,14 +37,6 @@
#include <math.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <gtk/gtk.h>
#include <wsutil/file_util.h>

View File

@ -28,9 +28,6 @@
*/
#include "config.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include <glib.h>

View File

@ -21,14 +21,6 @@
#include <config.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
// Qt 5.5.0 + Visual C++ 2013
#ifdef _MSC_VER
#pragma warning(push)

View File

@ -28,10 +28,6 @@
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#include "file.h"
#include <epan/epan.h>

View File

@ -113,10 +113,6 @@
#include <time.h>
#include <glib.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <errno.h>
#include <assert.h>

View File

@ -41,9 +41,6 @@
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "wsutil/filesystem.h"
#include "wsutil/file_util.h"
#include "wsutil/tempfile.h"

View File

@ -21,10 +21,6 @@
#include <errno.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "wtap-int.h"
#include "file_wrappers.h"
#include <wsutil/buffer.h>

View File

@ -23,14 +23,6 @@
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <errno.h>
#include <wsutil/file_util.h>

View File

@ -41,15 +41,8 @@
#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif /* HAVE_FCNTL_H */
#include <string.h>
#include "wtap-int.h"
#include "file_wrappers.h"

View File

@ -23,10 +23,6 @@
#include <errno.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "wtap-int.h"
#include "file_wrappers.h"
#include <wsutil/buffer.h>

View File

@ -21,10 +21,6 @@
#include <errno.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include "wtap-int.h"
#include "file_wrappers.h"
#include <wsutil/buffer.h>

View File

@ -27,10 +27,6 @@
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif

View File

@ -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

View File

@ -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>

View File

@ -31,10 +31,6 @@
#include <string.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib.h>
#include <gmodule.h>

View File

@ -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

View File

@ -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