[pacman-dev] [PATCH 2/2] Change type of count in be_sync

Rikard Falkeborn rikard.falkeborn at gmail.com
Thu Sep 22 18:00:01 UTC 2016


Making it size_t matches the return value of alpm_list_count() and
avoids the implicit cast to int.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn at gmail.com>
---
 lib/libalpm/be_sync.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index f127ed8..079db19 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -452,8 +452,8 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive)
 static int sync_db_populate(alpm_db_t *db)
 {
 	const char *dbpath;
-	size_t est_count;
-	int count, fd;
+	size_t est_count, count;
+	int fd;
 	int ret = 0;
 	struct stat buf;
 	struct archive *archive;
@@ -510,10 +510,10 @@ static int sync_db_populate(alpm_db_t *db)
 	count = alpm_list_count(db->pkgcache->list);
 	if(count > 0) {
 		db->pkgcache->list = alpm_list_msort(db->pkgcache->list,
-				(size_t)count, _alpm_pkg_cmp);
+				count, _alpm_pkg_cmp);
 	}
 	_alpm_log(db->handle, ALPM_LOG_DEBUG,
-			"added %d packages to package cache for db '%s'\n",
+			"added %zu packages to package cache for db '%s'\n",
 			count, db->treename);
 
 cleanup:
-- 
2.10.0


More information about the pacman-dev mailing list