I used ESR's deheader program to look for unused includes. I then
examined each instance by hand, and also test-compiled (on Linux).
---
src/actions-support.c | 4 ----
src/alloc.c | 3 ---
src/appliance.c | 8 --------
src/conn-socket.c | 1 -
src/copy-in-out.c | 2 --
src/create.c | 1 -
src/dbdump.c | 8 --------
src/drives.c | 7 -------
src/events.c | 5 -----
src/file.c | 3 ---
src/filearch.c | 4 ----
src/fuse.c | 2 --
src/handle.c | 3 ---
src/info.c | 3 ---
src/inspect-apps.c | 10 ----------
src/inspect-fs-cd.c | 11 -----------
src/inspect-fs-unix.c | 10 ----------
src/inspect-fs-windows.c | 6 ------
src/inspect-fs.c | 7 -------
src/inspect-icon.c | 5 -----
src/inspect.c | 3 ---
src/journal.c | 2 --
src/launch-direct.c | 4 ----
src/launch-libvirt.c | 9 ---------
src/launch-uml.c | 3 ---
src/launch-unix.c | 3 ---
src/launch.c | 3 ---
src/libvirt-auth.c | 4 ----
src/libvirt-domain.c | 1 -
src/listfs.c | 5 -----
src/lpj.c | 2 --
src/osinfo.c | 1 -
src/proto.c | 8 --------
src/stringsbuf.c | 1 -
src/tmpdirs.c | 3 ---
35 files changed, 155 deletions(-)
diff --git a/src/actions-support.c b/src/actions-support.c
index 23b9ba7..ca125ac 100644
--- a/src/actions-support.c
+++ b/src/actions-support.c
@@ -22,13 +22,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
/* Check the return message from a call for validity. */
diff --git a/src/alloc.c b/src/alloc.c
index 821fe18..76e043e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -23,9 +23,6 @@
#include <unistd.h>
#include <string.h>
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
-#include <libxml/xmlwriter.h>
#include "guestfs.h"
#include "guestfs-internal.h"
diff --git a/src/appliance.c b/src/appliance.c
index 793190a..137cd69 100644
--- a/src/appliance.c
+++ b/src/appliance.c
@@ -18,28 +18,20 @@
#include <config.h>
-#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
-#include <fcntl.h>
-#include <time.h>
#include <sys/stat.h>
-#include <sys/select.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <utime.h>
#include <libintl.h>
-#include "glthread/lock.h"
#include "ignore-value.h"
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
/* Old-style appliance is going to be obsoleted. */
static const char *kernel_name = "vmlinuz." host_cpu;
diff --git a/src/conn-socket.c b/src/conn-socket.c
index eb22b0c..7a5d586 100644
--- a/src/conn-socket.c
+++ b/src/conn-socket.c
@@ -28,7 +28,6 @@
#include <errno.h>
#include <poll.h>
#include <sys/stat.h>
-#include <sys/socket.h>
#include <sys/types.h>
#include <assert.h>
#include <libintl.h>
diff --git a/src/copy-in-out.c b/src/copy-in-out.c
index e3697c0..fdc3f38 100644
--- a/src/copy-in-out.c
+++ b/src/copy-in-out.c
@@ -20,8 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/src/create.c b/src/create.c
index d80939c..7f31bdb 100644
--- a/src/create.c
+++ b/src/create.c
@@ -39,7 +39,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
static int disk_create_raw (guestfs_h *g, const char *filename, int64_t size, const
struct guestfs_disk_create_argv *optargs);
static int disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size, const
char *backingfile, const struct guestfs_disk_create_argv *optargs);
diff --git a/src/dbdump.c b/src/dbdump.c
index db0f433..95a8dfb 100644
--- a/src/dbdump.c
+++ b/src/dbdump.c
@@ -20,13 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
#include <sys/wait.h>
#include <libintl.h>
@@ -34,8 +28,6 @@
#include <endian.h>
#endif
-#include <pcre.h>
-
#include "guestfs.h"
#include "guestfs-internal.h"
diff --git a/src/drives.c b/src/drives.c
index dd508f1..d957fc4 100644
--- a/src/drives.c
+++ b/src/drives.c
@@ -24,27 +24,20 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <stdbool.h>
#include <string.h>
-#include <inttypes.h>
#include <unistd.h>
-#include <fcntl.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <assert.h>
-#include <sys/types.h>
#include <libintl.h>
-#include <pcre.h>
-
#include "c-ctype.h"
#include "ignore-value.h"
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
/* Helper struct to hold all the data needed when creating a new
* drive.
diff --git a/src/events.c b/src/events.c
index 51b9948..3e5f165 100644
--- a/src/events.c
+++ b/src/events.c
@@ -20,12 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <inttypes.h>
-#include <unistd.h>
#include <assert.h>
-#include <string.h>
#include "c-ctype.h"
diff --git a/src/file.c b/src/file.c
index b4af164..5c783ef 100644
--- a/src/file.c
+++ b/src/file.c
@@ -20,8 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
@@ -34,7 +32,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
static int
compare (const void *vp1, const void *vp2)
diff --git a/src/filearch.c b/src/filearch.c
index 7b63719..5985b73 100644
--- a/src/filearch.c
+++ b/src/filearch.c
@@ -20,7 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
#include <string.h>
@@ -28,8 +27,6 @@
#include <sys/wait.h>
#include <libintl.h>
-#include <pcre.h>
-
#ifdef HAVE_LIBMAGIC
#include <magic.h>
#endif
@@ -39,7 +36,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
#if defined(HAVE_LIBMAGIC)
diff --git a/src/fuse.c b/src/fuse.c
index 9fb84ae..9f1d164 100644
--- a/src/fuse.c
+++ b/src/fuse.c
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
@@ -47,7 +46,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
#if HAVE_FUSE
diff --git a/src/handle.c b/src/handle.c
index da196d5..8f7e801 100644
--- a/src/handle.c
+++ b/src/handle.c
@@ -20,9 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include <libintl.h>
#ifdef HAVE_LIBVIRT
@@ -38,7 +36,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
static int shutdown_backend (guestfs_h *g, int check_for_errors);
static void close_handles (void);
diff --git a/src/info.c b/src/info.c
index de19202..02a1cf6 100644
--- a/src/info.c
+++ b/src/info.c
@@ -20,9 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <inttypes.h>
-#include <limits.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
@@ -47,7 +45,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
static int which_parser (guestfs_h *g);
static char *get_disk_format (guestfs_h *g, const char *filename);
diff --git a/src/inspect-apps.c b/src/inspect-apps.c
index 26091ab..dfe7213 100644
--- a/src/inspect-apps.c
+++ b/src/inspect-apps.c
@@ -20,13 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
@@ -58,14 +53,9 @@
#endif
#endif
-#include <pcre.h>
-
-#include "xstrtol.h"
-
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
#ifdef DB_DUMP
static struct guestfs_application2_list *list_applications_rpm (guestfs_h *g, struct
inspect_fs *fs);
diff --git a/src/inspect-fs-cd.c b/src/inspect-fs-cd.c
index 22d0921..3c3a515 100644
--- a/src/inspect-fs-cd.c
+++ b/src/inspect-fs-cd.c
@@ -20,27 +20,16 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
-#include <pcre.h>
-
#include "c-ctype.h"
-#include "xstrtol.h"
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
/* Debian/Ubuntu install disks are easy ...
*
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index f8e778f..a371f4d 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -20,31 +20,21 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
#include <libintl.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
-#include <pcre.h>
-
#include "c-ctype.h"
#include "ignore-value.h"
-#include "xstrtol.h"
-#include "hash.h"
#include "hash-pjw.h"
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
COMPILE_REGEXP (re_fedora, "Fedora release (\\d+)", 0)
COMPILE_REGEXP (re_rhel_old, "Red Hat.*release (\\d+).*Update (\\d+)", 0)
diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c
index 0342502..99d3843 100644
--- a/src/inspect-fs-windows.c
+++ b/src/inspect-fs-windows.c
@@ -20,12 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
#include <errno.h>
#include <iconv.h>
@@ -46,12 +42,10 @@
#include "c-ctype.h"
#include "ignore-value.h"
-#include "xstrtol.h"
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
COMPILE_REGEXP (re_windows_version, "^(\\d+)\\.(\\d+)", 0)
COMPILE_REGEXP (re_boot_ini_os_header, "^\\[operating systems\\]\\s*$", 0)
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index d2be5c3..5c8d6d7 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -20,13 +20,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
#include <libintl.h>
#ifdef HAVE_ENDIAN_H
@@ -40,8 +35,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
COMPILE_REGEXP (re_major_minor, "(\\d+)\\.(\\d+)", 0)
diff --git a/src/inspect-icon.c b/src/inspect-icon.c
index 15c721b..fe38266 100644
--- a/src/inspect-icon.c
+++ b/src/inspect-icon.c
@@ -20,18 +20,13 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <unistd.h>
-#include <fcntl.h>
#include <string.h>
-#include <errno.h>
#include <sys/wait.h>
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
/* External tools are required for some icon types. Check we have them. */
#if defined(PBMTEXT) && defined (PNMTOPNG)
diff --git a/src/inspect.c b/src/inspect.c
index 0cc3d9f..1eac037 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -20,13 +20,11 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
-#include <errno.h>
#include <libintl.h>
#ifdef HAVE_ENDIAN_H
@@ -38,7 +36,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
COMPILE_REGEXP (re_primary_partition, "^/dev/(?:h|s|v)d.[1234]$", 0)
diff --git a/src/journal.c b/src/journal.c
index b36b362..22b81de 100644
--- a/src/journal.c
+++ b/src/journal.c
@@ -20,7 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
@@ -45,7 +44,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
/* This is implemented library-side in order to get around potential
* protocol limits.
diff --git a/src/launch-direct.c b/src/launch-direct.c
index a00b938..4252d79 100644
--- a/src/launch-direct.c
+++ b/src/launch-direct.c
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
-#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
#include <errno.h>
@@ -31,8 +30,6 @@
#include <sys/stat.h>
#include <signal.h>
#include <sys/socket.h>
-#include <sys/un.h>
-#include <grp.h>
#include <assert.h>
#include <string.h>
#include <libintl.h>
@@ -46,7 +43,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
COMPILE_REGEXP (re_major_minor, "(\\d+)\\.(\\d+)", 0)
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index 4a2becd..8560aa3 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -23,12 +23,9 @@
#include <stdarg.h>
#include <stdbool.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
#include <grp.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/wait.h>
#include <assert.h>
#include <string.h>
#include <libintl.h>
@@ -38,24 +35,18 @@
#include <libvirt/virterror.h>
#endif
-#include <libxml/xmlIO.h>
#include <libxml/xmlwriter.h>
#include <libxml/xpath.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <libxml/xmlsave.h>
#if HAVE_LIBSELINUX
#include <selinux/selinux.h>
#include <selinux/context.h>
#endif
-#include "glthread/lock.h"
#include "base64.h"
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
/* Fixes for Mac OS X */
diff --git a/src/launch-uml.c b/src/launch-uml.c
index c368f21..2e4e091 100644
--- a/src/launch-uml.c
+++ b/src/launch-uml.c
@@ -22,10 +22,8 @@
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
-#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
@@ -36,7 +34,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
/* Per-handle data. */
diff --git a/src/launch-unix.c b/src/launch-unix.c
index 1dac58e..5cce9c1 100644
--- a/src/launch-unix.c
+++ b/src/launch-unix.c
@@ -21,15 +21,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <fcntl.h>
#include <sys/socket.h>
-#include <sys/un.h>
#include <string.h>
#include <libintl.h>
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
/* Alternate backend: instead of launching the appliance,
diff --git a/src/launch.c b/src/launch.c
index a6a88f0..35490a5 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -20,15 +20,12 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <stdbool.h>
#include <inttypes.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/wait.h>
#include <errno.h>
#include <assert.h>
#include <libintl.h>
diff --git a/src/libvirt-auth.c b/src/libvirt-auth.c
index caf9951..a4a249c 100644
--- a/src/libvirt-auth.c
+++ b/src/libvirt-auth.c
@@ -29,14 +29,10 @@
#include <libvirt/virterror.h>
#endif
-#include <libxml/xpath.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
#if defined(HAVE_LIBVIRT)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index c1d6c4c..79e7ba6 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -37,7 +37,6 @@
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
#if defined(HAVE_LIBVIRT)
diff --git a/src/listfs.c b/src/listfs.c
index 707e229..046cd4e 100644
--- a/src/listfs.c
+++ b/src/listfs.c
@@ -20,16 +20,11 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <unistd.h>
#include <string.h>
-#include <sys/stat.h>
#include "guestfs.h"
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
-#include "guestfs_protocol.h"
/* List filesystems.
*
diff --git a/src/lpj.c b/src/lpj.c
index 88afc18..e84b7fc 100644
--- a/src/lpj.c
+++ b/src/lpj.c
@@ -20,11 +20,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <sys/wait.h>
#include "glthread/lock.h"
diff --git a/src/osinfo.c b/src/osinfo.c
index 806e6de..3a8a709 100644
--- a/src/osinfo.c
+++ b/src/osinfo.c
@@ -51,7 +51,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <errno.h>
#include <dirent.h>
#include <assert.h>
#include <sys/types.h>
diff --git a/src/proto.c b/src/proto.c
index f8e8d39..3db3ac0 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -20,18 +20,12 @@
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <inttypes.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
-#include <time.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/wait.h>
#include <assert.h>
#include <libintl.h>
@@ -39,12 +33,10 @@
#include <rpc/xdr.h>
#include "c-ctype.h"
-#include "glthread/lock.h"
#include "ignore-value.h"
#include "guestfs.h"
#include "guestfs-internal.h"
-#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
/* Size of guestfs_progress message on the wire. */
diff --git a/src/stringsbuf.c b/src/stringsbuf.c
index 706ee5c..984a466 100644
--- a/src/stringsbuf.c
+++ b/src/stringsbuf.c
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
-#include <string.h>
#include "guestfs.h"
#include "guestfs-internal.h"
diff --git a/src/tmpdirs.c b/src/tmpdirs.c
index c2799c8..9154d8b 100644
--- a/src/tmpdirs.c
+++ b/src/tmpdirs.c
@@ -20,9 +20,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <libintl.h>
--
2.5.0