summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorIvy Foster <ivy.foster@gmail.com>2016-10-12 22:13:31 +0200
committerAllan McRae <allan@archlinux.org>2016-10-22 12:50:55 +0200
commita55adb81d0f6fcd7fe98cc444806b3b0d25efc9c (patch)
tree8bf6a8b9f048a9b1073d964ffcead9015f404bd0 /lib/libalpm/sync.c
parenta79be86f5751b4341f1339a32a5a8737439ac28d (diff)
downloadpacman-a55adb81d0f6fcd7fe98cc444806b3b0d25efc9c.tar.gz
pacman-a55adb81d0f6fcd7fe98cc444806b3b0d25efc9c.tar.xz
Add ALPM_ERR_OK to _alpm_errno_t
This allows functions which return an _alpm_errno_t to always return a genuine _alpm_errno_t for consistency, even in cases where there are no errors. Since ALPM_ERR_OK = 0, their callers can still simply check 'err = some_fn(); if (!err) { ... }'. Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 00b68d05..65c1bbc6 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -57,7 +57,7 @@ alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_syn
alpm_pkg_t *spkg = NULL;
ASSERT(pkg != NULL, return NULL);
- pkg->handle->pm_errno = 0;
+ pkg->handle->pm_errno = ALPM_ERR_OK;
for(i = dbs_sync; !spkg && i; i = i->next) {
alpm_db_t *db = i->data;
@@ -460,7 +460,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
transaction. The packages will be removed from the actual
transaction when the transaction packages are replaced with a
dependency-reordered list below */
- handle->pm_errno = 0;
+ handle->pm_errno = ALPM_ERR_OK;
if(data) {
alpm_list_free_inner(*data,
(alpm_list_fn_free)alpm_depmissing_free);
@@ -1195,7 +1195,7 @@ static int check_validity(alpm_handle_t *handle,
}
alpm_list_free(errors);
- if(!handle->pm_errno) {
+ if(handle->pm_errno == ALPM_ERR_OK) {
RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1);
}
return -1;
@@ -1280,7 +1280,7 @@ static int load_packages(alpm_handle_t *handle, alpm_list_t **data,
EVENT(handle, &event);
if(errors) {
- if(!handle->pm_errno) {
+ if(handle->pm_errno == ALPM_ERR_OK) {
RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1);
}
return -1;