Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorIvy Foster <ivy.foster@gmail.com>2016-10-12 15:13:31 -0500
committerAllan McRae <allan@archlinux.org>2016-10-22 20:50:55 +1000
commita55adb81d0f6fcd7fe98cc444806b3b0d25efc9c (patch)
tree8bf6a8b9f048a9b1073d964ffcead9015f404bd0 /lib/libalpm/db.c
parenta79be86f5751b4341f1339a32a5a8737439ac28d (diff)
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/db.c')
-rw-r--r--lib/libalpm/db.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index f70f83c1..46d2ccf3 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -112,7 +112,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
ASSERT(db != NULL, return -1);
/* Do not unregister a database if a transaction is on-going */
handle = db->handle;
- handle->pm_errno = 0;
+ handle->pm_errno = ALPM_ERR_OK;
ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1));
if(db == handle->db_local) {
@@ -179,7 +179,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
/* Sanity checks */
ASSERT(db != NULL, return -1);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
newurl = sanitize_url(url);
@@ -206,7 +206,7 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
/* Sanity checks */
ASSERT(db != NULL, return -1);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
newurl = sanitize_url(url);
@@ -249,7 +249,7 @@ alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
int SYMEXPORT alpm_db_get_valid(alpm_db_t *db)
{
ASSERT(db != NULL, return -1);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
return db->ops->validate(db);
}
@@ -258,7 +258,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
{
alpm_pkg_t *pkg;
ASSERT(db != NULL, return NULL);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
ASSERT(name != NULL && strlen(name) != 0,
RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL));
@@ -273,7 +273,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db)
{
ASSERT(db != NULL, return NULL);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
return _alpm_db_get_pkgcache(db);
}
@@ -292,7 +292,7 @@ alpm_group_t SYMEXPORT *alpm_db_get_group(alpm_db_t *db, const char *name)
alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
{
ASSERT(db != NULL, return NULL);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
return _alpm_db_get_groupcache(db);
}
@@ -301,7 +301,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
{
ASSERT(db != NULL, return NULL);
- db->handle->pm_errno = 0;
+ db->handle->pm_errno = ALPM_ERR_OK;
return _alpm_db_search(db, needles);
}