index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/trans.c | 23 |
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: |