From b961ebe16ffb75bb947a193daa9e9fe639b6403d Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Wed, 7 Sep 2011 20:41:09 -0500 Subject: query check: use provided filelist count instead of keeping track We don't need to keep track of how many files are in a package now that said value is provided to us. It also makes more sense to use size_t here for types rather than the (hopefully never too short) int. Signed-off-by: Dan McGee --- src/pacman/query.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/pacman/query.c b/src/pacman/query.c index 9dbc5297..1098b853 100644 --- a/src/pacman/query.c +++ b/src/pacman/query.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -405,7 +406,7 @@ static int filter(alpm_pkg_t *pkg) static int check(alpm_pkg_t *pkg) { const char *root, *pkgname; - int allfiles = 0, errors = 0; + size_t errors = 0; size_t rootlen; char f[PATH_MAX]; alpm_filelist_t *filelist; @@ -432,7 +433,6 @@ static int check(alpm_pkg_t *pkg) continue; } strcpy(f + rootlen, path); - allfiles++; /* use lstat to prevent errors from symlinks */ if(lstat(f, &st) != 0) { if(config->quiet) { @@ -446,10 +446,10 @@ static int check(alpm_pkg_t *pkg) } if(!config->quiet) { - printf(_n("%s: %d total file, ", "%s: %d total files, ", - (unsigned long)allfiles), pkgname, allfiles); - printf(_n("%d missing file\n", "%d missing files\n", - (unsigned long)errors), errors); + printf(_n("%s: %jd total file, ", "%s: %jd total files, ", + (unsigned long)filelist->count), pkgname, (intmax_t)filelist->count); + printf(_n("%jd missing file\n", "%jd missing files\n", + (unsigned long)errors), (intmax_t)errors); } return (errors != 0 ? 1 : 0); -- cgit v1.2.3-24-g4f1b