summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-09-07 20:41:09 -0500
committerDan McGee <dan@archlinux.org>2011-09-07 20:51:35 -0500
commitb961ebe16ffb75bb947a193daa9e9fe639b6403d (patch)
treed29cf4d6eca41174a4f0fe2c617829d39e7b22d4
parent6317db84295430c2d2d164f81ff723b379b33035 (diff)
downloadpacman-b961ebe16ffb75bb947a193daa9e9fe639b6403d.tar.xz
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 <dan@archlinux.org>
-rw-r--r--src/pacman/query.c12
1 files changed, 6 insertions, 6 deletions
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 <stdlib.h>
#include <stdio.h>
+#include <stdint.h>
#include <limits.h>
#include <string.h>
#include <sys/stat.h>
@@ -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);