Return boolean from db_populate

Since the number of packages is not used anywhere, just return a
boolean to avoid the implicit cast from size_t to int in be_local.c.
Use 0 as success to be consistent with db_validate.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Rikard Falkeborn 2016-09-22 20:00:00 +02:00 committed by Allan McRae
parent 34f3f1e7a6
commit 85171807c1
2 changed files with 4 additions and 3 deletions

View File

@ -612,7 +612,7 @@ static int local_db_populate(alpm_db_t *db)
_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %zu packages to package cache for db '%s'\n",
count, db->treename);
return count;
return 0;
}
/* Note: the return value must be freed by the caller */

View File

@ -464,6 +464,7 @@ static int sync_db_populate(alpm_db_t *db)
const char *dbpath;
size_t est_count;
int count, fd;
int ret = 0;
struct stat buf;
struct archive *archive;
struct archive_entry *entry;
@ -497,7 +498,7 @@ static int sync_db_populate(alpm_db_t *db)
db->pkgcache = _alpm_pkghash_create(est_count);
if(db->pkgcache == NULL) {
db->handle->pm_errno = ALPM_ERR_MEMORY;
count = -1;
ret = -1;
goto cleanup;
}
@ -530,7 +531,7 @@ cleanup:
if(fd >= 0) {
close(fd);
}
return count;
return ret;
}
/* This function validates %FILENAME%. filename must be between 3 and