Richard W.M. Jones
2015-Sep-29 21:06 UTC
[Libguestfs] [PATCH 1/4] lib: actions: Remove some unused header files.
--- generator/c.ml | 2 -- 1 file changed, 2 deletions(-) diff --git a/generator/c.ml b/generator/c.ml index 055b683..963cf21 100644 --- a/generator/c.ml +++ b/generator/c.ml @@ -1213,9 +1213,7 @@ and generate_client_actions hash () #include <stdlib.h> #include <stdint.h> #include <inttypes.h> -#include <sys/types.h> #include <sys/stat.h> -#include <string.h> #include \"guestfs.h\" #include \"guestfs-internal.h\" -- 2.5.0
Richard W.M. Jones
2015-Sep-29 21:06 UTC
[Libguestfs] [PATCH 2/4] lib: Move <libintl.h> -> files that use it.
Don't include <libintl.h> (for gettext etc) in <guestfs-internal.h>. Include include it only in files that use internationalized strings. --- src/appliance.c | 1 + src/conn-socket.c | 1 + src/copy-in-out.c | 1 + src/create.c | 1 + src/dbdump.c | 1 + src/drives.c | 1 + src/errors.c | 1 + src/filearch.c | 1 + src/fuse.c | 1 + src/guestfs-internal.h | 2 -- src/handle.c | 1 + src/info.c | 1 + src/inspect-fs-unix.c | 1 + src/inspect-fs.c | 1 + src/inspect.c | 1 + src/launch-direct.c | 1 + src/launch-libvirt.c | 1 + src/launch-uml.c | 1 + src/launch-unix.c | 1 + src/launch.c | 1 + src/libvirt-auth.c | 1 + src/libvirt-domain.c | 1 + src/osinfo.c | 1 + src/proto.c | 1 + src/tmpdirs.c | 1 + src/whole-file.c | 1 + 26 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/appliance.c b/src/appliance.c index 2645cca..793190a 100644 --- a/src/appliance.c +++ b/src/appliance.c @@ -31,6 +31,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <utime.h> +#include <libintl.h> #include "glthread/lock.h" #include "ignore-value.h" diff --git a/src/conn-socket.c b/src/conn-socket.c index 3ead48f..eb22b0c 100644 --- a/src/conn-socket.c +++ b/src/conn-socket.c @@ -31,6 +31,7 @@ #include <sys/socket.h> #include <sys/types.h> #include <assert.h> +#include <libintl.h> #include "guestfs.h" #include "guestfs-internal.h" diff --git a/src/copy-in-out.c b/src/copy-in-out.c index d5e7fb0..e3697c0 100644 --- a/src/copy-in-out.c +++ b/src/copy-in-out.c @@ -28,6 +28,7 @@ #include <sys/wait.h> #include <errno.h> #include <string.h> +#include <libintl.h> #include "guestfs.h" #include "guestfs-internal.h" diff --git a/src/create.c b/src/create.c index e9bac95..d80939c 100644 --- a/src/create.c +++ b/src/create.c @@ -30,6 +30,7 @@ #include <sys/ioctl.h> #include <errno.h> #include <string.h> +#include <libintl.h> #ifdef HAVE_LINUX_FS_H #include <linux/fs.h> diff --git a/src/dbdump.c b/src/dbdump.c index 13d4a97..db0f433 100644 --- a/src/dbdump.c +++ b/src/dbdump.c @@ -28,6 +28,7 @@ #include <sys/stat.h> #include <errno.h> #include <sys/wait.h> +#include <libintl.h> #ifdef HAVE_ENDIAN_H #include <endian.h> diff --git a/src/drives.c b/src/drives.c index ad747ab..dd508f1 100644 --- a/src/drives.c +++ b/src/drives.c @@ -34,6 +34,7 @@ #include <arpa/inet.h> #include <assert.h> #include <sys/types.h> +#include <libintl.h> #include <pcre.h> diff --git a/src/errors.c b/src/errors.c index 2d3ae84..c259884 100644 --- a/src/errors.c +++ b/src/errors.c @@ -23,6 +23,7 @@ #include <stdarg.h> #include <string.h> #include <errno.h> +#include <libintl.h> #include "c-ctype.h" diff --git a/src/filearch.c b/src/filearch.c index 29c9ba6..7b63719 100644 --- a/src/filearch.c +++ b/src/filearch.c @@ -26,6 +26,7 @@ #include <string.h> #include <sys/stat.h> #include <sys/wait.h> +#include <libintl.h> #include <pcre.h> diff --git a/src/fuse.c b/src/fuse.c index 332c1be..9fb84ae 100644 --- a/src/fuse.c +++ b/src/fuse.c @@ -25,6 +25,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <string.h> +#include <libintl.h> #if HAVE_FUSE /* See <attr/xattr.h> */ diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index 9c7175f..5776a6e 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -21,8 +21,6 @@ #include <stdbool.h> -#include <libintl.h> - #include <rpc/types.h> #include <rpc/xdr.h> diff --git a/src/handle.c b/src/handle.c index 1bfb9ae..da196d5 100644 --- a/src/handle.c +++ b/src/handle.c @@ -23,6 +23,7 @@ #include <unistd.h> #include <string.h> #include <errno.h> +#include <libintl.h> #ifdef HAVE_LIBVIRT #include <libvirt/libvirt.h> diff --git a/src/info.c b/src/info.c index bfd7860..de19202 100644 --- a/src/info.c +++ b/src/info.c @@ -30,6 +30,7 @@ #include <sys/wait.h> #include <assert.h> #include <string.h> +#include <libintl.h> #ifdef HAVE_SYS_TIME_H #include <sys/time.h> diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index f2e1d9f..f8e778f 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -27,6 +27,7 @@ #include <string.h> #include <sys/stat.h> #include <errno.h> +#include <libintl.h> #ifdef HAVE_ENDIAN_H #include <endian.h> diff --git a/src/inspect-fs.c b/src/inspect-fs.c index b6f03ee..d2be5c3 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -27,6 +27,7 @@ #include <string.h> #include <sys/stat.h> #include <errno.h> +#include <libintl.h> #ifdef HAVE_ENDIAN_H #include <endian.h> diff --git a/src/inspect.c b/src/inspect.c index 7c7ee0c..0cc3d9f 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -27,6 +27,7 @@ #include <string.h> #include <sys/stat.h> #include <errno.h> +#include <libintl.h> #ifdef HAVE_ENDIAN_H #include <endian.h> diff --git a/src/launch-direct.c b/src/launch-direct.c index ea67ec9..a00b938 100644 --- a/src/launch-direct.c +++ b/src/launch-direct.c @@ -35,6 +35,7 @@ #include <grp.h> #include <assert.h> #include <string.h> +#include <libintl.h> #include <pcre.h> diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c index d4c4c47..4a2becd 100644 --- a/src/launch-libvirt.c +++ b/src/launch-libvirt.c @@ -31,6 +31,7 @@ #include <sys/wait.h> #include <assert.h> #include <string.h> +#include <libintl.h> #ifdef HAVE_LIBVIRT #include <libvirt/libvirt.h> diff --git a/src/launch-uml.c b/src/launch-uml.c index 785548c..c368f21 100644 --- a/src/launch-uml.c +++ b/src/launch-uml.c @@ -30,6 +30,7 @@ #include <sys/socket.h> #include <sys/wait.h> #include <sys/signal.h> +#include <libintl.h> #include "cloexec.h" diff --git a/src/launch-unix.c b/src/launch-unix.c index dae4389..1dac58e 100644 --- a/src/launch-unix.c +++ b/src/launch-unix.c @@ -25,6 +25,7 @@ #include <sys/socket.h> #include <sys/un.h> #include <string.h> +#include <libintl.h> #include "guestfs.h" #include "guestfs-internal.h" diff --git a/src/launch.c b/src/launch.c index 343f4ea..a6a88f0 100644 --- a/src/launch.c +++ b/src/launch.c @@ -31,6 +31,7 @@ #include <sys/wait.h> #include <errno.h> #include <assert.h> +#include <libintl.h> #include "guestfs.h" #include "guestfs-internal.h" diff --git a/src/libvirt-auth.c b/src/libvirt-auth.c index 98ac047..caf9951 100644 --- a/src/libvirt-auth.c +++ b/src/libvirt-auth.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <stdbool.h> #include <string.h> +#include <libintl.h> #ifdef HAVE_LIBVIRT #include <libvirt/libvirt.h> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 3a19306..c1d6c4c 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -23,6 +23,7 @@ #include <stdbool.h> #include <assert.h> #include <string.h> +#include <libintl.h> #ifdef HAVE_LIBVIRT #include <libvirt/libvirt.h> diff --git a/src/osinfo.c b/src/osinfo.c index f7e1548..806e6de 100644 --- a/src/osinfo.c +++ b/src/osinfo.c @@ -55,6 +55,7 @@ #include <dirent.h> #include <assert.h> #include <sys/types.h> +#include <libintl.h> #include <libxml/parser.h> #include <libxml/xpath.h> diff --git a/src/proto.c b/src/proto.c index 815a4d2..f8e8d39 100644 --- a/src/proto.c +++ b/src/proto.c @@ -33,6 +33,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <assert.h> +#include <libintl.h> #include <rpc/types.h> #include <rpc/xdr.h> diff --git a/src/tmpdirs.c b/src/tmpdirs.c index b1f1445..c2799c8 100644 --- a/src/tmpdirs.c +++ b/src/tmpdirs.c @@ -25,6 +25,7 @@ #include <limits.h> #include <sys/types.h> #include <sys/stat.h> +#include <libintl.h> #include "ignore-value.h" diff --git a/src/whole-file.c b/src/whole-file.c index 38050d9..2563db5 100644 --- a/src/whole-file.c +++ b/src/whole-file.c @@ -23,6 +23,7 @@ #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> +#include <libintl.h> #include "guestfs.h" #include "guestfs-internal.h" -- 2.5.0
Richard W.M. Jones
2015-Sep-29 21:06 UTC
[Libguestfs] [PATCH 3/4] lib: Don't need to include <rpc/types.h>.
It is already included by <rpc/xdr.h>. --- src/guestfs-internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index 5776a6e..e316ebe 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -21,7 +21,6 @@ #include <stdbool.h> -#include <rpc/types.h> #include <rpc/xdr.h> #include <pcre.h> -- 2.5.0
Richard W.M. Jones
2015-Sep-29 21:06 UTC
[Libguestfs] [PATCH 4/4] lib: Remove unused header files.
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
Pino Toscano
2015-Sep-30 12:05 UTC
Re: [Libguestfs] [PATCH 4/4] lib: Remove unused header files.
On Tuesday 29 September 2015 22:06:13 Richard W.M. Jones wrote:> I used ESR's deheader program to look for unused includes. I then > examined each instance by hand, and also test-compiled (on Linux).Mostly LGTM, there just a couple of notes below:> --- a/src/fuse.c > +++ b/src/fuse.c > @@ -21,7 +21,6 @@ > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > -#include <errno.h>EINVAL is used here.> --- a/src/launch-direct.c > +++ b/src/launch-direct.c > @@ -31,8 +30,6 @@ > #include <sys/stat.h> > #include <signal.h> > #include <sys/socket.h> > -#include <sys/un.h>Isn't this needed by sockaddr_un? -- Pino Toscano
Pino Toscano
2015-Sep-30 12:11 UTC
Re: [Libguestfs] [PATCH 1/4] lib: actions: Remove some unused header files.
On Tuesday 29 September 2015 22:06:10 Richard W.M. Jones wrote:> --- > generator/c.ml | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/generator/c.ml b/generator/c.ml > index 055b683..963cf21 100644 > --- a/generator/c.ml > +++ b/generator/c.ml > @@ -1213,9 +1213,7 @@ and generate_client_actions hash () > #include <stdlib.h> > #include <stdint.h> > #include <inttypes.h> > -#include <sys/types.h> > #include <sys/stat.h> > -#include <string.h>See 78b27cc0b64a3e7b72602fc05102968b34fe529d about this. At least memset is used all around in the actions-N.c generated by this function, so IMHO string.h is justified here (apparently something pulls it implicitly on Linux with GNU libc, but not so on other libc's). -- Pino Toscano
Pino Toscano
2015-Sep-30 12:13 UTC
Re: [Libguestfs] [PATCH 2/4] lib: Move <libintl.h> -> files that use it.
On Tuesday 29 September 2015 22:06:11 Richard W.M. Jones wrote:> Don't include <libintl.h> (for gettext etc) in <guestfs-internal.h>. > Include include it only in files that use internationalized strings.LGTM. -- Pino Toscano
Pino Toscano
2015-Sep-30 12:15 UTC
Re: [Libguestfs] [PATCH 3/4] lib: Don't need to include <rpc/types.h>.
On Tuesday 29 September 2015 22:06:12 Richard W.M. Jones wrote:> It is already included by <rpc/xdr.h>.LGTM. -- Pino Toscano
Richard W.M. Jones
2015-Sep-30 12:32 UTC
Re: [Libguestfs] [PATCH 1/4] lib: actions: Remove some unused header files.
On Wed, Sep 30, 2015 at 02:11:19PM +0200, Pino Toscano wrote:> On Tuesday 29 September 2015 22:06:10 Richard W.M. Jones wrote: > > --- > > generator/c.ml | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/generator/c.ml b/generator/c.ml > > index 055b683..963cf21 100644 > > --- a/generator/c.ml > > +++ b/generator/c.ml > > @@ -1213,9 +1213,7 @@ and generate_client_actions hash () > > #include <stdlib.h> > > #include <stdint.h> > > #include <inttypes.h> > > -#include <sys/types.h> > > #include <sys/stat.h> > > -#include <string.h> > > See 78b27cc0b64a3e7b72602fc05102968b34fe529d about this. > At least memset is used all around in the actions-N.c generated by this > function, so IMHO string.h is justified here (apparently something > pulls it implicitly on Linux with GNU libc, but not so on other libc's).OK, I'm just going to drop this patch. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Possibly Parallel Threads
- [PATCH 1/4] lib: actions: Remove some unused header files.
- [PATCH 4/4] lib: Remove unused header files.
- Re: [PATCH 4/4] lib: Remove unused header files.
- Re: [PATCH] build: remove unused gnulib modules
- [PATCH 2/5] threads: Acquire and release the lock around each public guestfs_* API.