summaryrefslogtreecommitdiff
path: root/lib/libalpm/remove.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-09 16:00:55 -0500
committerDan McGee <dan@archlinux.org>2011-06-13 19:32:59 -0500
commitfb3ad7f8823dd3300528b44427d40e17594b1400 (patch)
tree8932518e67553383a178d23fcdd07beb24dc801e /lib/libalpm/remove.c
parent01ad3faee934aa805237bf5405e7c74dc1482a17 (diff)
downloadpacman-fb3ad7f8823dd3300528b44427d40e17594b1400.tar.xz
Add handle argument to alpm_(add|remove)_pkg()
This makes these functions consistent with the rest of the transaction related API calls. We do an additional assert to ensure the handle attached to the package is the same as the handle passed in. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/remove.c')
-rw-r--r--lib/libalpm/remove.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index f32e77d8..fedc7faa 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -44,14 +44,16 @@
#include "deps.h"
#include "handle.h"
-int SYMEXPORT alpm_remove_pkg(pmpkg_t *pkg)
+int SYMEXPORT alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg)
{
pmtrans_t *trans;
const char *pkgname;
/* Sanity checks */
+ ASSERT(handle != NULL, return -1);
ASSERT(pkg != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- trans = pkg->handle->trans;
+ ASSERT(handle == pkg->handle, RET_ERR(PM_ERR_WRONG_ARGS, -1));
+ trans = handle->trans;
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_INITIALIZED,
RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));