[pacman-dev] [PATCH] Remove unneeded header inclusions

Silvan Jegen s.jegen at gmail.com
Sun Mar 2 15:24:43 EST 2014


I checked only a few files but if you think cleaning up the includes is
worth the hassle I could continue to check further files.

(see: http://sillymon.ch/data/diskspace_8c__incl.png for example)

-- >8 --

These headers are included transitively and can be removed.

Signed-off-by: Silvan Jegen <s.jegen at gmail.com>
---
 lib/libalpm/add.c       | 14 --------------
 lib/libalpm/alpm.c      |  2 --
 lib/libalpm/backup.c    |  3 ---
 lib/libalpm/diskspace.c |  3 ---
 lib/libalpm/filelist.c  |  2 --
 lib/libalpm/util.h      |  3 ---
 6 files changed, 27 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index f38afef..133b85c 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -18,31 +18,17 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
 #include <errno.h>
-#include <string.h>
 #include <limits.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 #include <unistd.h>
-#include <stdint.h> /* int64_t */
-
-/* libarchive */
-#include <archive.h>
-#include <archive_entry.h>
 
 /* libalpm */
 #include "add.h"
 #include "alpm.h"
-#include "alpm_list.h"
-#include "handle.h"
 #include "libarchive-compat.h"
-#include "trans.h"
 #include "util.h"
 #include "log.h"
 #include "backup.h"
-#include "package.h"
 #include "db.h"
 #include "remove.h"
 #include "handle.h"
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index 4a69bf8..a56b17b 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -27,8 +27,6 @@
 
 /* libalpm */
 #include "alpm.h"
-#include "alpm_list.h"
-#include "handle.h"
 #include "log.h"
 #include "util.h"
 
diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c
index c2989b6..10bd0de 100644
--- a/lib/libalpm/backup.c
+++ b/lib/libalpm/backup.c
@@ -21,9 +21,6 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdlib.h>
-#include <string.h>
-
 /* libalpm */
 #include "backup.h"
 #include "alpm_list.h"
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index d07b188..52d6bf7 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -17,7 +17,6 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
 #include <errno.h>
 
 #if defined(HAVE_MNTENT_H)
@@ -44,11 +43,9 @@
 
 /* libalpm */
 #include "diskspace.h"
-#include "alpm_list.h"
 #include "util.h"
 #include "log.h"
 #include "trans.h"
-#include "handle.h"
 
 static int mount_point_cmp(const void *p1, const void *p2)
 {
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c
index 2d2426c..33ac957 100644
--- a/lib/libalpm/filelist.c
+++ b/lib/libalpm/filelist.c
@@ -18,8 +18,6 @@
  */
 
 #include <limits.h>
-#include <string.h>
-#include <sys/stat.h>
 
 /* libalpm */
 #include "filelist.h"
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 250c530..b7f6c8b 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -24,7 +24,6 @@
 #ifndef _ALPM_UTIL_H
 #define _ALPM_UTIL_H
 
-#include "alpm_list.h"
 #include "alpm.h"
 #include "package.h" /* alpm_pkg_t */
 #include "handle.h" /* alpm_handle_t */
@@ -40,8 +39,6 @@
 #include <float.h> /* DBL_EPSILON */
 #include <fcntl.h> /* open, close */
 
-#include <archive.h> /* struct archive */
-
 #ifdef ENABLE_NLS
 #include <libintl.h> /* here so it doesn't need to be included elsewhere */
 /* define _() as shortcut for gettext() */
-- 
1.9.0



More information about the pacman-dev mailing list