From 19b8b638851713da64dd2aa7ff31e911ffe925cd Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Sun, 7 Jun 2009 14:30:11 +0200 Subject: 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 Signed-off-by: Dan McGee --- lib/libalpm/sync.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib/libalpm/sync.c') 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; } -- cgit v1.2.3-24-g4f1b