Ensure handle is valid and pm_errno is reset when calling into API
We didn't do due diligence before and ensure prior pm_errno values weren't influencing what happened in further ALPM calls. I observed one case of early setup code setting pm_errno to PM_ERR_WRONG_ARGS and that flag persisting the entire time we were calling library code. Add a new CHECK_HANDLE() macro that does two things: 1) ensures the handle variable passed to it is non-NULL and 2) clears any existing pm_errno flag set on the handle. This macro can replace many places we used the ASSERT(handle != NULL, ...) pattern before. Several other other places only need a simple 'set to zero' of the pm_errno field. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
be97276735
commit
ee015f086f
15 changed files with 128 additions and 69 deletions
|
@ -57,7 +57,7 @@ int SYMEXPORT alpm_add_pkg(pmhandle_t *handle, pmpkg_t *pkg)
|
||||||
pmpkg_t *local;
|
pmpkg_t *local;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
|
@ -715,11 +715,12 @@ int _alpm_upgrade_packages(pmhandle_t *handle)
|
||||||
|
|
||||||
/* loop through our package list adding/upgrading one at a time */
|
/* loop through our package list adding/upgrading one at a time */
|
||||||
for(targ = trans->add; targ; targ = targ->next) {
|
for(targ = trans->add; targ; targ = targ->next) {
|
||||||
|
pmpkg_t *newpkg = targ->data;
|
||||||
|
|
||||||
if(handle->trans->state == STATE_INTERRUPTED) {
|
if(handle->trans->state == STATE_INTERRUPTED) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkg_t *newpkg = (pmpkg_t *)targ->data;
|
|
||||||
if(commit_single_pkg(handle, newpkg, pkg_current, pkg_count)) {
|
if(commit_single_pkg(handle, newpkg, pkg_current, pkg_count)) {
|
||||||
/* something screwed up on the commit, abort the trans */
|
/* something screwed up on the commit, abort the trans */
|
||||||
trans->state = STATE_INTERRUPTED;
|
trans->state = STATE_INTERRUPTED;
|
||||||
|
|
|
@ -104,7 +104,7 @@ int SYMEXPORT alpm_release(pmhandle_t *myhandle)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
pmdb_t *db;
|
pmdb_t *db;
|
||||||
|
|
||||||
ASSERT(myhandle != NULL, return -1);
|
CHECK_HANDLE(myhandle, return -1);
|
||||||
|
|
||||||
/* close local database */
|
/* close local database */
|
||||||
db = myhandle->db_local;
|
db = myhandle->db_local;
|
||||||
|
|
|
@ -386,7 +386,7 @@ error:
|
||||||
int SYMEXPORT alpm_pkg_load(pmhandle_t *handle, const char *filename, int full,
|
int SYMEXPORT alpm_pkg_load(pmhandle_t *handle, const char *filename, int full,
|
||||||
pgp_verify_t check_sig, pmpkg_t **pkg)
|
pgp_verify_t check_sig, pmpkg_t **pkg)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
*pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig);
|
*pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig);
|
||||||
|
|
|
@ -116,6 +116,7 @@ int SYMEXPORT alpm_db_update(int force, pmdb_t *db)
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
handle = db->handle;
|
handle = db->handle;
|
||||||
|
handle->pm_errno = 0;
|
||||||
ASSERT(db != handle->db_local, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(db != handle->db_local, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
ASSERT(db->servers != NULL, RET_ERR(handle, PM_ERR_SERVER_NONE, -1));
|
ASSERT(db->servers != NULL, RET_ERR(handle, PM_ERR_SERVER_NONE, -1));
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,7 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages)
|
||||||
alpm_list_t SYMEXPORT *alpm_checkconflicts(pmhandle_t *handle,
|
alpm_list_t SYMEXPORT *alpm_checkconflicts(pmhandle_t *handle,
|
||||||
alpm_list_t *pkglist)
|
alpm_list_t *pkglist)
|
||||||
{
|
{
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return _alpm_innerconflicts(handle, pkglist);
|
return _alpm_innerconflicts(handle, pkglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
pmdb_t SYMEXPORT *alpm_db_register_sync(pmhandle_t *handle, const char *treename)
|
pmdb_t SYMEXPORT *alpm_db_register_sync(pmhandle_t *handle, const char *treename)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
ASSERT(treename != NULL && strlen(treename) != 0,
|
ASSERT(treename != NULL && strlen(treename) != 0,
|
||||||
RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL));
|
RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL));
|
||||||
/* Do not register a database if a transaction is on-going */
|
/* Do not register a database if a transaction is on-going */
|
||||||
|
@ -75,7 +75,7 @@ int SYMEXPORT alpm_db_unregister_all(pmhandle_t *handle)
|
||||||
pmdb_t *db;
|
pmdb_t *db;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
/* Do not unregister a database if a transaction is on-going */
|
/* Do not unregister a database if a transaction is on-going */
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
/* Do not unregister a database if a transaction is on-going */
|
/* Do not unregister a database if a transaction is on-going */
|
||||||
handle = db->handle;
|
handle = db->handle;
|
||||||
|
handle->pm_errno = 0;
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
if(db == handle->db_local) {
|
if(db == handle->db_local) {
|
||||||
|
@ -165,6 +166,7 @@ int SYMEXPORT alpm_db_add_server(pmdb_t *db, const char *url)
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
newurl = sanitize_url(url);
|
||||||
|
@ -190,6 +192,7 @@ int SYMEXPORT alpm_db_remove_server(pmdb_t *db, const char *url)
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
newurl = sanitize_url(url);
|
newurl = sanitize_url(url);
|
||||||
|
@ -216,6 +219,7 @@ int SYMEXPORT alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
|
||||||
db->pgp_verify = verify;
|
db->pgp_verify = verify;
|
||||||
_alpm_log(db->handle, PM_LOG_DEBUG, "adding VerifySig option to database '%s': %d\n",
|
_alpm_log(db->handle, PM_LOG_DEBUG, "adding VerifySig option to database '%s': %d\n",
|
||||||
|
@ -235,7 +239,9 @@ const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db)
|
||||||
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
ASSERT(name != NULL && strlen(name) != 0, return NULL);
|
db->handle->pm_errno = 0;
|
||||||
|
ASSERT(name != NULL && strlen(name) != 0,
|
||||||
|
RET_ERR(db->handle, PM_ERR_WRONG_ARGS, NULL));
|
||||||
|
|
||||||
return _alpm_db_get_pkgfromcache(db, name);
|
return _alpm_db_get_pkgfromcache(db, name);
|
||||||
}
|
}
|
||||||
|
@ -244,6 +250,7 @@ pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
||||||
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
|
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
return _alpm_db_get_pkgcache(db);
|
return _alpm_db_get_pkgcache(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +258,9 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
|
||||||
pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
ASSERT(name != NULL && strlen(name) != 0, return NULL);
|
db->handle->pm_errno = 0;
|
||||||
|
ASSERT(name != NULL && strlen(name) != 0,
|
||||||
|
RET_ERR(db->handle, PM_ERR_WRONG_ARGS, NULL));
|
||||||
|
|
||||||
return _alpm_db_get_grpfromcache(db, name);
|
return _alpm_db_get_grpfromcache(db, name);
|
||||||
}
|
}
|
||||||
|
@ -260,6 +269,7 @@ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
||||||
alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
|
alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
|
||||||
return _alpm_db_get_grpcache(db);
|
return _alpm_db_get_grpcache(db);
|
||||||
}
|
}
|
||||||
|
@ -268,6 +278,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
|
||||||
alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
|
||||||
return _alpm_db_search(db, needles);
|
return _alpm_db_search(db, needles);
|
||||||
}
|
}
|
||||||
|
@ -276,6 +287,7 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
||||||
int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason)
|
int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
/* TODO assert db == db_local ? shouldn't need a db param at all here... */
|
/* TODO assert db == db_local ? shouldn't need a db param at all here... */
|
||||||
ASSERT(name != NULL, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(name != NULL, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
|
|
|
@ -273,6 +273,8 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
|
||||||
alpm_list_t *baddeps = NULL;
|
alpm_list_t *baddeps = NULL;
|
||||||
int nodepversion;
|
int nodepversion;
|
||||||
|
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
|
||||||
targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade));
|
targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade));
|
||||||
for(i = pkglist; i; i = i->next) {
|
for(i = pkglist; i; i = i->next) {
|
||||||
pmpkg_t *pkg = i->data;
|
pmpkg_t *pkg = i->data;
|
||||||
|
@ -657,7 +659,8 @@ pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(pmhandle_t *handle,
|
||||||
pmdepend_t *dep;
|
pmdepend_t *dep;
|
||||||
pmpkg_t *pkg;
|
pmpkg_t *pkg;
|
||||||
|
|
||||||
ASSERT(dbs, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
ASSERT(dbs, RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL));
|
||||||
|
|
||||||
dep = _alpm_splitdep(depstring);
|
dep = _alpm_splitdep(depstring);
|
||||||
ASSERT(dep, return NULL);
|
ASSERT(dep, return NULL);
|
||||||
|
|
|
@ -337,6 +337,8 @@ char SYMEXPORT *alpm_fetch_pkgurl(pmhandle_t *handle, const char *url)
|
||||||
const char *filename, *cachedir;
|
const char *filename, *cachedir;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
CHECK_HANDLE(handle, return NULL);
|
||||||
|
|
||||||
filename = get_filename(url);
|
filename = get_filename(url);
|
||||||
|
|
||||||
/* find a valid cache dir to download to */
|
/* find a valid cache dir to download to */
|
||||||
|
|
|
@ -88,148 +88,148 @@ void _alpm_handle_free(pmhandle_t *handle)
|
||||||
|
|
||||||
alpm_cb_log SYMEXPORT alpm_option_get_logcb(pmhandle_t *handle)
|
alpm_cb_log SYMEXPORT alpm_option_get_logcb(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->logcb;
|
return handle->logcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_download SYMEXPORT alpm_option_get_dlcb(pmhandle_t *handle)
|
alpm_cb_download SYMEXPORT alpm_option_get_dlcb(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->dlcb;
|
return handle->dlcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb(pmhandle_t *handle)
|
alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->fetchcb;
|
return handle->fetchcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(pmhandle_t *handle)
|
alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->totaldlcb;
|
return handle->totaldlcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_root(pmhandle_t *handle)
|
const char SYMEXPORT *alpm_option_get_root(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->root;
|
return handle->root;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_dbpath(pmhandle_t *handle)
|
const char SYMEXPORT *alpm_option_get_dbpath(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->dbpath;
|
return handle->dbpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->cachedirs;
|
return handle->cachedirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_logfile(pmhandle_t *handle)
|
const char SYMEXPORT *alpm_option_get_logfile(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->logfile;
|
return handle->logfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_lockfile(pmhandle_t *handle)
|
const char SYMEXPORT *alpm_option_get_lockfile(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->lockfile;
|
return handle->lockfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_signaturedir(pmhandle_t *handle)
|
const char SYMEXPORT *alpm_option_get_signaturedir(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->signaturedir;
|
return handle->signaturedir;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usesyslog(pmhandle_t *handle)
|
int SYMEXPORT alpm_option_get_usesyslog(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
return handle->usesyslog;
|
return handle->usesyslog;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_noupgrades(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_option_get_noupgrades(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->noupgrade;
|
return handle->noupgrade;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_noextracts(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_option_get_noextracts(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->noextract;
|
return handle->noextract;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->ignorepkg;
|
return handle->ignorepkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->ignoregrp;
|
return handle->ignoregrp;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_option_get_arch(pmhandle_t *handle)
|
const char SYMEXPORT *alpm_option_get_arch(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->arch;
|
return handle->arch;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_usedelta(pmhandle_t *handle)
|
int SYMEXPORT alpm_option_get_usedelta(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
return handle->usedelta;
|
return handle->usedelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_get_checkspace(pmhandle_t *handle)
|
int SYMEXPORT alpm_option_get_checkspace(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
return handle->checkspace;
|
return handle->checkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t SYMEXPORT *alpm_option_get_localdb(pmhandle_t *handle)
|
pmdb_t SYMEXPORT *alpm_option_get_localdb(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->db_local;
|
return handle->db_local;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_option_get_syncdbs(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->dbs_sync;
|
return handle->dbs_sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_logcb(pmhandle_t *handle, alpm_cb_log cb)
|
int SYMEXPORT alpm_option_set_logcb(pmhandle_t *handle, alpm_cb_log cb)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->logcb = cb;
|
handle->logcb = cb;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_dlcb(pmhandle_t *handle, alpm_cb_download cb)
|
int SYMEXPORT alpm_option_set_dlcb(pmhandle_t *handle, alpm_cb_download cb)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->dlcb = cb;
|
handle->dlcb = cb;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_fetchcb(pmhandle_t *handle, alpm_cb_fetch cb)
|
int SYMEXPORT alpm_option_set_fetchcb(pmhandle_t *handle, alpm_cb_fetch cb)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->fetchcb = cb;
|
handle->fetchcb = cb;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_totaldlcb(pmhandle_t *handle, alpm_cb_totaldl cb)
|
int SYMEXPORT alpm_option_set_totaldlcb(pmhandle_t *handle, alpm_cb_totaldl cb)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->totaldlcb = cb;
|
handle->totaldlcb = cb;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ int SYMEXPORT alpm_option_add_cachedir(pmhandle_t *handle, const char *cachedir)
|
||||||
{
|
{
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
|
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(!cachedir) {
|
if(!cachedir) {
|
||||||
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -301,7 +301,7 @@ int SYMEXPORT alpm_option_add_cachedir(pmhandle_t *handle, const char *cachedir)
|
||||||
int SYMEXPORT alpm_option_set_cachedirs(pmhandle_t *handle, alpm_list_t *cachedirs)
|
int SYMEXPORT alpm_option_set_cachedirs(pmhandle_t *handle, alpm_list_t *cachedirs)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->cachedirs) {
|
if(handle->cachedirs) {
|
||||||
FREELIST(handle->cachedirs);
|
FREELIST(handle->cachedirs);
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ int SYMEXPORT alpm_option_remove_cachedir(pmhandle_t *handle, const char *cached
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
size_t cachedirlen;
|
size_t cachedirlen;
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
/* verify cachedir ends in a '/' */
|
/* verify cachedir ends in a '/' */
|
||||||
cachedirlen = strlen(cachedir);
|
cachedirlen = strlen(cachedir);
|
||||||
if(cachedir[cachedirlen-1] != '/') {
|
if(cachedir[cachedirlen-1] != '/') {
|
||||||
|
@ -341,7 +341,7 @@ int SYMEXPORT alpm_option_set_logfile(pmhandle_t *handle, const char *logfile)
|
||||||
{
|
{
|
||||||
char *oldlogfile = handle->logfile;
|
char *oldlogfile = handle->logfile;
|
||||||
|
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(!logfile) {
|
if(!logfile) {
|
||||||
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -364,7 +364,7 @@ int SYMEXPORT alpm_option_set_logfile(pmhandle_t *handle, const char *logfile)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_signaturedir(pmhandle_t *handle, const char *signaturedir)
|
int SYMEXPORT alpm_option_set_signaturedir(pmhandle_t *handle, const char *signaturedir)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(!signaturedir) {
|
if(!signaturedir) {
|
||||||
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -381,21 +381,21 @@ int SYMEXPORT alpm_option_set_signaturedir(pmhandle_t *handle, const char *signa
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_usesyslog(pmhandle_t *handle, int usesyslog)
|
int SYMEXPORT alpm_option_set_usesyslog(pmhandle_t *handle, int usesyslog)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->usesyslog = usesyslog;
|
handle->usesyslog = usesyslog;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_add_noupgrade(pmhandle_t *handle, const char *pkg)
|
int SYMEXPORT alpm_option_add_noupgrade(pmhandle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_noupgrades(pmhandle_t *handle, alpm_list_t *noupgrade)
|
int SYMEXPORT alpm_option_set_noupgrades(pmhandle_t *handle, alpm_list_t *noupgrade)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->noupgrade) FREELIST(handle->noupgrade);
|
if(handle->noupgrade) FREELIST(handle->noupgrade);
|
||||||
handle->noupgrade = alpm_list_strdup(noupgrade);
|
handle->noupgrade = alpm_list_strdup(noupgrade);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -404,7 +404,7 @@ int SYMEXPORT alpm_option_set_noupgrades(pmhandle_t *handle, alpm_list_t *noupgr
|
||||||
int SYMEXPORT alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg)
|
int SYMEXPORT alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &vdata);
|
handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
|
@ -415,14 +415,14 @@ int SYMEXPORT alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_add_noextract(pmhandle_t *handle, const char *pkg)
|
int SYMEXPORT alpm_option_add_noextract(pmhandle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_noextracts(pmhandle_t *handle, alpm_list_t *noextract)
|
int SYMEXPORT alpm_option_set_noextracts(pmhandle_t *handle, alpm_list_t *noextract)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->noextract) FREELIST(handle->noextract);
|
if(handle->noextract) FREELIST(handle->noextract);
|
||||||
handle->noextract = alpm_list_strdup(noextract);
|
handle->noextract = alpm_list_strdup(noextract);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -431,7 +431,7 @@ int SYMEXPORT alpm_option_set_noextracts(pmhandle_t *handle, alpm_list_t *noextr
|
||||||
int SYMEXPORT alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg)
|
int SYMEXPORT alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &vdata);
|
handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
|
@ -442,14 +442,14 @@ int SYMEXPORT alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_add_ignorepkg(pmhandle_t *handle, const char *pkg)
|
int SYMEXPORT alpm_option_add_ignorepkg(pmhandle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_ignorepkgs(pmhandle_t *handle, alpm_list_t *ignorepkgs)
|
int SYMEXPORT alpm_option_set_ignorepkgs(pmhandle_t *handle, alpm_list_t *ignorepkgs)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
|
if(handle->ignorepkg) FREELIST(handle->ignorepkg);
|
||||||
handle->ignorepkg = alpm_list_strdup(ignorepkgs);
|
handle->ignorepkg = alpm_list_strdup(ignorepkgs);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -458,7 +458,7 @@ int SYMEXPORT alpm_option_set_ignorepkgs(pmhandle_t *handle, alpm_list_t *ignore
|
||||||
int SYMEXPORT alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg)
|
int SYMEXPORT alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
|
handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
|
@ -469,14 +469,14 @@ int SYMEXPORT alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_add_ignoregrp(pmhandle_t *handle, const char *grp)
|
int SYMEXPORT alpm_option_add_ignoregrp(pmhandle_t *handle, const char *grp)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
|
handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_ignoregrps(pmhandle_t *handle, alpm_list_t *ignoregrps)
|
int SYMEXPORT alpm_option_set_ignoregrps(pmhandle_t *handle, alpm_list_t *ignoregrps)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
|
if(handle->ignoregrp) FREELIST(handle->ignoregrp);
|
||||||
handle->ignoregrp = alpm_list_strdup(ignoregrps);
|
handle->ignoregrp = alpm_list_strdup(ignoregrps);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -485,7 +485,7 @@ int SYMEXPORT alpm_option_set_ignoregrps(pmhandle_t *handle, alpm_list_t *ignore
|
||||||
int SYMEXPORT alpm_option_remove_ignoregrp(pmhandle_t *handle, const char *grp)
|
int SYMEXPORT alpm_option_remove_ignoregrp(pmhandle_t *handle, const char *grp)
|
||||||
{
|
{
|
||||||
char *vdata = NULL;
|
char *vdata = NULL;
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata);
|
handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata);
|
||||||
if(vdata != NULL) {
|
if(vdata != NULL) {
|
||||||
FREE(vdata);
|
FREE(vdata);
|
||||||
|
@ -496,7 +496,7 @@ int SYMEXPORT alpm_option_remove_ignoregrp(pmhandle_t *handle, const char *grp)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_arch(pmhandle_t *handle, const char *arch)
|
int SYMEXPORT alpm_option_set_arch(pmhandle_t *handle, const char *arch)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(handle->arch) FREE(handle->arch);
|
if(handle->arch) FREE(handle->arch);
|
||||||
if(arch) {
|
if(arch) {
|
||||||
handle->arch = strdup(arch);
|
handle->arch = strdup(arch);
|
||||||
|
@ -508,21 +508,21 @@ int SYMEXPORT alpm_option_set_arch(pmhandle_t *handle, const char *arch)
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_usedelta(pmhandle_t *handle, int usedelta)
|
int SYMEXPORT alpm_option_set_usedelta(pmhandle_t *handle, int usedelta)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->usedelta = usedelta;
|
handle->usedelta = usedelta;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_checkspace(pmhandle_t *handle, int checkspace)
|
int SYMEXPORT alpm_option_set_checkspace(pmhandle_t *handle, int checkspace)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
handle->checkspace = checkspace;
|
handle->checkspace = checkspace;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t level)
|
int SYMEXPORT alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t level)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(level != PM_PGP_VERIFY_UNKNOWN, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(level != PM_PGP_VERIFY_UNKNOWN, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
handle->sigverify = level;
|
handle->sigverify = level;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -530,7 +530,7 @@ int SYMEXPORT alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t
|
||||||
|
|
||||||
pgp_verify_t SYMEXPORT alpm_option_get_default_sigverify(pmhandle_t *handle)
|
pgp_verify_t SYMEXPORT alpm_option_get_default_sigverify(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
ASSERT(handle != NULL, return PM_PGP_VERIFY_UNKNOWN);
|
CHECK_HANDLE(handle, return PM_PGP_VERIFY_UNKNOWN);
|
||||||
return handle->sigverify;
|
return handle->sigverify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,10 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
ASSERT(pkg != NULL, return -1);
|
ASSERT(pkg != NULL, return -1);
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
/* We only inspect packages from sync repositories */
|
/* We only inspect packages from sync repositories */
|
||||||
ASSERT(pkg->origin == PKG_FROM_SYNCDB, return -1);
|
ASSERT(pkg->origin == PKG_FROM_SYNCDB,
|
||||||
|
RET_ERR(pkg->handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
fpath = _alpm_filecache_find(pkg->handle, alpm_pkg_get_filename(pkg));
|
fpath = _alpm_filecache_find(pkg->handle, alpm_pkg_get_filename(pkg));
|
||||||
|
|
||||||
|
@ -162,116 +164,139 @@ struct pkg_operations default_pkg_ops = {
|
||||||
* package, which depend on where the package was loaded from. */
|
* package, which depend on where the package was loaded from. */
|
||||||
const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_filename(pkg);
|
return pkg->ops->get_filename(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->name;
|
return pkg->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->version;
|
return pkg->version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_desc(pkg);
|
return pkg->ops->get_desc(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_url(pkg);
|
return pkg->ops->get_url(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t SYMEXPORT alpm_pkg_get_builddate(pmpkg_t *pkg)
|
time_t SYMEXPORT alpm_pkg_get_builddate(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_builddate(pkg);
|
return pkg->ops->get_builddate(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t SYMEXPORT alpm_pkg_get_installdate(pmpkg_t *pkg)
|
time_t SYMEXPORT alpm_pkg_get_installdate(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_installdate(pkg);
|
return pkg->ops->get_installdate(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_packager(pkg);
|
return pkg->ops->get_packager(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_md5sum(pkg);
|
return pkg->ops->get_md5sum(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
|
const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_arch(pkg);
|
return pkg->ops->get_arch(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
off_t SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
|
off_t SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_size(pkg);
|
return pkg->ops->get_size(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
off_t SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg)
|
off_t SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_isize(pkg);
|
return pkg->ops->get_isize(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg)
|
pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_reason(pkg);
|
return pkg->ops->get_reason(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_licenses(pkg);
|
return pkg->ops->get_licenses(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_groups(pkg);
|
return pkg->ops->get_groups(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_depends(pkg);
|
return pkg->ops->get_depends(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_optdepends(pkg);
|
return pkg->ops->get_optdepends(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_conflicts(pkg);
|
return pkg->ops->get_conflicts(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_provides(pkg);
|
return pkg->ops->get_provides(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_replaces(pkg);
|
return pkg->ops->get_replaces(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_deltas(pkg);
|
return pkg->ops->get_deltas(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_files(pkg);
|
return pkg->ops->get_files(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
|
alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->get_backup(pkg);
|
return pkg->ops->get_backup(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +305,7 @@ pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(pkg != NULL, return NULL);
|
ASSERT(pkg != NULL, return NULL);
|
||||||
ASSERT(pkg->origin != PKG_FROM_FILE, return NULL);
|
ASSERT(pkg->origin != PKG_FROM_FILE, return NULL);
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
|
|
||||||
return pkg->origin_data.db;
|
return pkg->origin_data.db;
|
||||||
}
|
}
|
||||||
|
@ -287,6 +313,7 @@ pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
|
||||||
/** Open a package changelog for reading. */
|
/** Open a package changelog for reading. */
|
||||||
void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
|
void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->changelog_open(pkg);
|
return pkg->ops->changelog_open(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,6 +321,7 @@ void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
|
||||||
size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size,
|
size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size,
|
||||||
const pmpkg_t *pkg, const void *fp)
|
const pmpkg_t *pkg, const void *fp)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->changelog_read(ptr, size, pkg, fp);
|
return pkg->ops->changelog_read(ptr, size, pkg, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,17 +335,21 @@ int SYMEXPORT alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp)
|
||||||
/** Close a package changelog for reading. */
|
/** Close a package changelog for reading. */
|
||||||
int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
|
int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->changelog_close(pkg, fp);
|
return pkg->ops->changelog_close(pkg, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
|
int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
return pkg->ops->has_scriptlet(pkg);
|
return pkg->ops->has_scriptlet(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
|
static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i;
|
const alpm_list_t *i;
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
|
|
||||||
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
|
||||||
pmpkg_t *cachepkg = i->data;
|
pmpkg_t *cachepkg = i->data;
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
@ -339,6 +371,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
|
||||||
alpm_list_t *reqs = NULL;
|
alpm_list_t *reqs = NULL;
|
||||||
pmdb_t *db;
|
pmdb_t *db;
|
||||||
|
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
|
|
||||||
if(pkg->origin == PKG_FROM_FILE) {
|
if(pkg->origin == PKG_FROM_FILE) {
|
||||||
/* The sane option; search locally for things that require this. */
|
/* The sane option; search locally for things that require this. */
|
||||||
find_requiredby(pkg, pkg->handle->db_local, &reqs);
|
find_requiredby(pkg, pkg->handle->db_local, &reqs);
|
||||||
|
|
|
@ -50,7 +50,7 @@ int SYMEXPORT alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg)
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
|
|
|
@ -386,6 +386,7 @@ pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db)
|
||||||
int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg)
|
int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
ASSERT(pkg != NULL, return 0);
|
ASSERT(pkg != NULL, return 0);
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
|
|
||||||
return _alpm_gpgme_checksig(pkg->handle, alpm_pkg_get_filename(pkg),
|
return _alpm_gpgme_checksig(pkg->handle, alpm_pkg_get_filename(pkg),
|
||||||
pkg->base64_sig);
|
pkg->base64_sig);
|
||||||
|
@ -399,6 +400,7 @@ int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg)
|
||||||
int SYMEXPORT alpm_db_check_pgp_signature(pmdb_t *db)
|
int SYMEXPORT alpm_db_check_pgp_signature(pmdb_t *db)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return 0);
|
ASSERT(db != NULL, return 0);
|
||||||
|
db->handle->pm_errno = 0;
|
||||||
|
|
||||||
return _alpm_gpgme_checksig(db->handle, _alpm_db_path(db), NULL);
|
return _alpm_gpgme_checksig(db->handle, _alpm_db_path(db), NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,11 +55,12 @@
|
||||||
*/
|
*/
|
||||||
pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync)
|
pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync)
|
||||||
{
|
{
|
||||||
ASSERT(pkg != NULL, return NULL);
|
|
||||||
|
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmpkg_t *spkg = NULL;
|
pmpkg_t *spkg = NULL;
|
||||||
|
|
||||||
|
ASSERT(pkg != NULL, return NULL);
|
||||||
|
pkg->handle->pm_errno = 0;
|
||||||
|
|
||||||
for(i = dbs_sync; !spkg && i; i = i->next) {
|
for(i = dbs_sync; !spkg && i; i = i->next) {
|
||||||
spkg = _alpm_db_get_pkgfromcache(i->data, alpm_pkg_get_name(pkg));
|
spkg = _alpm_db_get_pkgfromcache(i->data, alpm_pkg_get_name(pkg));
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade)
|
||||||
pmdb_t *db_local;
|
pmdb_t *db_local;
|
||||||
alpm_list_t *dbs_sync;
|
alpm_list_t *dbs_sync;
|
||||||
|
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
db_local = handle->db_local;
|
db_local = handle->db_local;
|
||||||
dbs_sync = handle->dbs_sync;
|
dbs_sync = handle->dbs_sync;
|
||||||
|
|
|
@ -105,7 +105,7 @@ int SYMEXPORT alpm_trans_init(pmhandle_t *handle, pmtransflag_t flags,
|
||||||
int db_version;
|
int db_version;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
/* lock db */
|
/* lock db */
|
||||||
|
@ -168,7 +168,7 @@ int SYMEXPORT alpm_trans_prepare(pmhandle_t *handle, alpm_list_t **data)
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(data != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(data != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
||||||
|
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
|
@ -212,7 +212,7 @@ int SYMEXPORT alpm_trans_commit(pmhandle_t *handle, alpm_list_t **data)
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ int SYMEXPORT alpm_trans_interrupt(pmhandle_t *handle)
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
|
ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
|
||||||
|
@ -269,7 +269,7 @@ int SYMEXPORT alpm_trans_release(pmhandle_t *handle)
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
|
ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
|
||||||
|
@ -414,7 +414,7 @@ cleanup:
|
||||||
pmtransflag_t SYMEXPORT alpm_trans_get_flags(pmhandle_t *handle)
|
pmtransflag_t SYMEXPORT alpm_trans_get_flags(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
|
ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1));
|
||||||
|
|
||||||
return handle->trans->flags;
|
return handle->trans->flags;
|
||||||
|
@ -423,7 +423,7 @@ pmtransflag_t SYMEXPORT alpm_trans_get_flags(pmhandle_t *handle)
|
||||||
alpm_list_t SYMEXPORT *alpm_trans_get_add(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_trans_get_add(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL));
|
ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL));
|
||||||
|
|
||||||
return handle->trans->add;
|
return handle->trans->add;
|
||||||
|
@ -432,7 +432,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_add(pmhandle_t *handle)
|
||||||
alpm_list_t SYMEXPORT *alpm_trans_get_remove(pmhandle_t *handle)
|
alpm_list_t SYMEXPORT *alpm_trans_get_remove(pmhandle_t *handle)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(handle != NULL, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL));
|
ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL));
|
||||||
|
|
||||||
return handle->trans->remove;
|
return handle->trans->remove;
|
||||||
|
|
|
@ -71,6 +71,8 @@
|
||||||
|
|
||||||
#define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON)
|
#define DOUBLE_EQ(x, y) (fabs((x) - (y)) < DBL_EPSILON)
|
||||||
|
|
||||||
|
#define CHECK_HANDLE(handle, action) do { if(!(handle)) { action; } (handle)->pm_errno = 0; } while(0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used as a buffer/state holder for _alpm_archive_fgets().
|
* Used as a buffer/state holder for _alpm_archive_fgets().
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue