[pacman-dev] [PATCH 1/2] dirent usage cleanup
We were including the header in a lot of places it is no longer used. Additionally, use the correct autoconf macro for determining whether d_type is available as a member: HAVE_STRUCT_DIRENT_D_TYPE. Signed-off-by: Dan McGee <dan@archlinux.org> --- configure.ac | 1 + lib/libalpm/be_local.c | 2 +- lib/libalpm/be_sync.c | 1 - lib/libalpm/db.c | 1 - lib/libalpm/sync.c | 1 - src/pacman/callback.c | 1 - 6 files changed, 2 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 6f601f4..e8541d2 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,7 @@ AC_TYPE_PID_T AC_TYPE_SIZE_T AC_STRUCT_TM AC_TYPE_UID_T +AC_STRUCT_DIRENT_D_TYPE # Checks for library functions. AC_FUNC_FORK diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 2212752..988248d 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -340,7 +340,7 @@ static int checkdbdir(pmdb_t *db) static int is_dir(const char *path, struct dirent *entry) { -#ifdef DT_DIR +#ifdef HAVE_STRUCT_DIRENT_D_TYPE return(entry->d_type == DT_DIR); #else char buffer[PATH_MAX]; diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index e1c7663..bec6abe 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -21,7 +21,6 @@ #include "config.h" #include <errno.h> -#include <dirent.h> #include <ctype.h> #include <locale.h> diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 79d20d4..1e7d3a2 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -29,7 +29,6 @@ #include <errno.h> #include <string.h> #include <sys/stat.h> -#include <dirent.h> #include <regex.h> #include <time.h> diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 1e73b8b..2fd79ea 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -31,7 +31,6 @@ #include <stdint.h> /* intmax_t */ #include <unistd.h> #include <time.h> -#include <dirent.h> /* libalpm */ #include "sync.h" diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 32dafb5..925f1fc 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -26,7 +26,6 @@ #include <sys/time.h> #include <sys/types.h> /* off_t */ #include <unistd.h> -#include <dirent.h> #include <wchar.h> #include <alpm.h> -- 1.7.3.2
This macro is deemed unnecessary by even the autoconf guys, so we really don't need to use it. Signed-off-by: Dan McGee <dan@archlinux.org> --- configure.ac | 1 - lib/libalpm/dload.c | 2 +- src/pacman/pacman.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index e8541d2..a8987a4 100644 --- a/configure.ac +++ b/configure.ac @@ -185,7 +185,6 @@ AC_STRUCT_DIRENT_D_TYPE AC_FUNC_FORK AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK AC_FUNC_MKTIME -AC_TYPE_SIGNAL AC_CHECK_FUNCS([geteuid realpath regcomp strcasecmp \ strndup strrchr strsep swprintf \ wcwidth uname]) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 9b59f52..1cb24e6 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -89,7 +89,7 @@ static const char *gethost(struct url *fileurl) } int dload_interrupted; -static RETSIGTYPE inthandler(int signum) +static void inthandler(int signum) { dload_interrupted = 1; } diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 15abecc..e3bea2c 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -261,7 +261,7 @@ static ssize_t xwrite(int fd, const void *buf, size_t count) * in a consistant state. * @param signum the thrown signal */ -static RETSIGTYPE handler(int signum) +static void handler(int signum) { int out = fileno(stdout); int err = fileno(stderr); -- 1.7.3.2
participants (1)
-
Dan McGee