summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2009-06-07 14:30:11 +0200
committerDan McGee <dan@archlinux.org>2009-06-07 22:11:16 +0200
commit19b8b638851713da64dd2aa7ff31e911ffe925cd (patch)
tree20ca058a5f6b1ffab444b0c09e98a85d16f09455 /lib/libalpm/sync.c
parente61ab1536f4b198ac5c62cf68d706d93bc6481be (diff)
downloadpacman-19b8b638851713da64dd2aa7ff31e911ffe925cd.tar.gz
pacman-19b8b638851713da64dd2aa7ff31e911ffe925cd.tar.xz
Introduce _alpm_pkg_free_trans()
The main purpose of this function to make our code more readable. It frees transaction specific fields of pmpkg_t. (It is used when a package is removed from the target list.) Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 35e6fca4..1d42cd9d 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -379,12 +379,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
}
/* Unresolvable packages will be removed from the target list, so
- we free the transaction specific field: pkg->removes */
- for(i = unresolvable; i; i = i->next) {
- pmpkg_t *pkg = i->data;
- alpm_list_free(pkg->removes);
- pkg->removes = NULL;
- }
+ we free the transaction specific fields */
+ alpm_list_free_inner(unresolvable, (alpm_list_fn_free)_alpm_pkg_free_trans);
/* Set DEPEND reason for pulled packages */
for(i = resolved; i; i = i->next) {
@@ -458,8 +454,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
_alpm_log(PM_LOG_WARNING,
_("removing '%s' from target list because it conflicts with '%s'\n"),
rsync->name, sync->name);
- alpm_list_free(rsync->removes); /* rsync is not transaction target anymore */
- rsync->removes = NULL;
+ _alpm_pkg_free_trans(rsync); /* rsync is not transaction target anymore */
trans->packages = alpm_list_remove(trans->packages, rsync, _alpm_pkg_cmp, NULL);
continue;
}