diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2006-02-07 20:08:02 +0100 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-02-07 20:08:02 +0100 |
commit | bbb48a85f07fbfd61672c5a8e3c332b62e67af41 (patch) | |
tree | f559408241d24970350f4bc6f3d9dcfee2b68726 /lib/libalpm | |
parent | f34d895dc50e208d6d0bac1de07d790fa8ff1ac9 (diff) | |
download | pacman-bbb48a85f07fbfd61672c5a8e3c332b62e67af41.tar.gz pacman-bbb48a85f07fbfd61672c5a8e3c332b62e67af41.tar.xz |
code factorization
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/sync.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index b32bc278..ecc57ed3 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -478,6 +478,7 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList ** * (not the same behavior as in pacman 2.x) */ } else { char *rmpkg = NULL; + char *target, *depend; /* hmmm, depend.name isn't installed, so it must be conflicting * with another package in our final list. For example: * @@ -491,18 +492,18 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList ** /* figure out which one was requested in targets. If they both were, * then it's still an unresolvable conflict. */ - if(pm_list_is_strin(miss->depend.name, trans->targets) - && !pm_list_is_strin(miss->target, trans->targets)) { + target = pm_list_is_strin(miss->depend.name, trans->targets); + depend = pm_list_is_strin(miss->target, trans->targets); + if(depend && !target) { _alpm_log(PM_LOG_DEBUG, "%s is in the target list -- keeping it", miss->depend.name); /* remove miss->target */ - rmpkg = strdup(miss->target); - } else if(pm_list_is_strin(miss->target, trans->targets) - && !pm_list_is_strin(miss->depend.name, trans->targets)) { + rmpkg = miss->target; + } else if(target && !depend) { _alpm_log(PM_LOG_DEBUG, "%s is in the target list -- keeping it", miss->target); /* remove miss->depend.name */ - rmpkg = strdup(miss->depend.name); + rmpkg = miss->depend.name; } else { /* something's not right, bail out with a conflict error */ } @@ -512,7 +513,6 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList ** _alpm_log(PM_LOG_FLOW2, "removing %s from target list", rmpkg); trans->packages = _alpm_list_remove(trans->packages, rsync, ptr_cmp, (void **)&spkg); FREESYNC(spkg); - FREE(rmpkg); continue; } } |