Detected by a simple Shell script:
for i in $(find -type f -name "*.[ch]" | grep -v gnulib); do
awk 'BEGIN {
FS=" "
fail=0
}
/^# *include.*\.h[">]$/{
arr[$NF]++
}
END {
for (key in arr) {
if (arr[key] > 1) {
fail=1
printf("%d %s\n", arr[key], key)
}
}
if (fail == 1)
exit 1
}' $i
if test $? != 0; then
echo "Duplicate header(s) in $i"
fi
done;
A later patch will add the syntax-check to avoid duplicate
headers.
---
daemon/libvirtd.c | 1 -
src/conf/node_device_conf.c | 1 -
src/network/bridge_driver.c | 1 -
src/openvz/openvz_conf.c | 1 -
src/openvz/openvz_driver.c | 1 -
src/parallels/parallels_driver.c | 1 -
src/phyp/phyp_driver.c | 1 -
src/qemu/qemu_capabilities.h | 1 -
src/qemu/qemu_driver.c | 1 -
src/security/security_selinux.c | 1 -
src/uml/uml_driver.c | 1 -
src/util/virnetdevtap.c | 1 -
src/xen/xen_hypervisor.c | 1 -
13 files changed, 13 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 34a8737..38b7346 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -51,7 +51,6 @@
#include "virnetlink.h"
#include "virnetserver.h"
#include "remote.h"
-#include "remote_driver.h"
#include "virhook.h"
#include "viraudit.h"
#include "locking/lock_manager.h"
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index b4d8cb3..8fe4e03 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -31,7 +31,6 @@
#include "viralloc.h"
#include "node_device_conf.h"
-#include "viralloc.h"
#include "virxml.h"
#include "virutil.h"
#include "virbuffer.h"
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e8b314a..3b27980 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -39,7 +39,6 @@
#include <signal.h>
#include <paths.h>
#include <pwd.h>
-#include <stdio.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <net/if.h>
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 4b21c4e..a6f96c7 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -36,7 +36,6 @@
#include <dirent.h>
#include <time.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <limits.h>
#include <errno.h>
#include <string.h>
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 9b10624..5d22c63 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -41,7 +41,6 @@
#include <fcntl.h>
#include <paths.h>
#include <pwd.h>
-#include <stdio.h>
#include <sys/wait.h>
#include "virerror.h"
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 5b8d85f..0c0bfcb 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -35,7 +35,6 @@
#include <fcntl.h>
#include <paths.h>
#include <pwd.h>
-#include <stdio.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/statvfs.h>
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 50e8216..3057345 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -33,7 +33,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
-#include <stdio.h>
#include <libssh2.h>
#include <netinet/in.h>
#include <arpa/inet.h>
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 7a0f191..d903f6f 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -27,7 +27,6 @@
# include "virobject.h"
# include "capabilities.h"
# include "vircommand.h"
-# include "virobject.h"
# include "qemu_monitor.h"
/* Internal flags to keep track of qemu command line capabilities */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7c167b7..cee5557 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -38,7 +38,6 @@
#include <fcntl.h>
#include <signal.h>
#include <paths.h>
-#include <stdio.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/un.h>
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 7333a1f..c620a2e 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -43,7 +43,6 @@
#include "virfile.h"
#include "virhash.h"
#include "virrandom.h"
-#include "virutil.h"
#include "virconf.h"
#include "virtpm.h"
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 4fc2315..498d1d9 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -38,7 +38,6 @@
#include <signal.h>
#include <paths.h>
#include <pwd.h>
-#include <stdio.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/inotify.h>
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 871376e..e4ce223 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -29,7 +29,6 @@
#include "virnetdevopenvswitch.h"
#include "virerror.h"
#include "virfile.h"
-#include "virerror.h"
#include "viralloc.h"
#include "virlog.h"
#include "virutil.h"
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index e16fffe..9dbbe07 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -33,7 +33,6 @@
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <limits.h>
-#include <stdint.h>
#include <regex.h>
#include <errno.h>
--
1.8.1.4