summaryrefslogtreecommitdiff
path: root/lib/libalpm/trans.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-04-06 18:25:33 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-04-06 18:25:33 +0000
commit04e054f3cbc9ddda9d99e4891055ae2743b3b8ff (patch)
treec3b389113853b45b4bc99bf707a037a4ce186efc /lib/libalpm/trans.c
parent08b34b8aef5e5567c9f186ed9c6ae2b5a7aee47b (diff)
downloadpacman-04e054f3cbc9ddda9d99e4891055ae2743b3b8ff.tar.xz
replaced transaction 'packages' field by 2 queues: one for packages to be installed and the other for the ones to be removed
Diffstat (limited to 'lib/libalpm/trans.c')
-rw-r--r--lib/libalpm/trans.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 6e278cd7..af0c6b7d 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -45,7 +45,8 @@ pmtrans_t *trans_new()
}
trans->targets = NULL;
- trans->packages = NULL;
+ trans->install_q = NULL;
+ trans->remove_q = NULL;
trans->type = 0;
trans->flags = 0;
trans->cb = NULL;
@@ -63,9 +64,17 @@ void trans_free(pmtrans_t *trans)
FREELIST(trans->targets);
/* ORE - ugly */
if(trans->type == PM_TRANS_TYPE_SYNC) {
- FREELISTPTR(trans->packages);
+ PMList *i = trans->install_q;
+ while(i) {
+ PMList *j = i->next;
+ sync_free(i->data);
+ i->data = NULL;
+ pm_list_free(i);
+ i = j;
+ }
} else {
- FREELISTPKGS(trans->packages);
+ FREELISTPKGS(trans->install_q);
+ FREELISTPKGS(trans->remove_q);
}
free(trans);
@@ -133,7 +142,9 @@ int trans_prepare(pmtrans_t *trans, PMList **data)
/* Sanity checks */
ASSERT(trans != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
- ASSERT(trans->packages != NULL, return(0));
+ if(trans->install_q == NULL && trans->remove_q == NULL) {
+ return(0);
+ }
switch(trans->type) {
case PM_TRANS_TYPE_ADD:
@@ -168,7 +179,9 @@ int trans_commit(pmtrans_t *trans)
ASSERT(trans != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1));
/* If there's nothing to do, return without complaining */
- ASSERT(trans->packages != NULL, return(0));
+ if(trans->install_q == NULL && trans->remove_q == NULL) {
+ return(0);
+ }
switch(trans->type) {
case PM_TRANS_TYPE_ADD: