diff options
author | Michael Schroeder <mls@suse.de> | 2012-11-20 15:40:56 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-11-20 15:40:56 +0100 |
commit | 78bc17cb1b658e723e7855c0cc645c68f2971a6e (patch) | |
tree | 17862d2b193d616c6f51af092b77bdbb712e4351 /src/transaction.c | |
parent | a68828a07dbcb2d61545dcb2bb73c9abdcd55d24 (diff) | |
download | libsolv-78bc17cb1b658e723e7855c0cc645c68f2971a6e.tar.gz libsolv-78bc17cb1b658e723e7855c0cc645c68f2971a6e.tar.bz2 libsolv-78bc17cb1b658e723e7855c0cc645c68f2971a6e.zip |
solver_samerule -> solver_rulecmp
Diffstat (limited to 'src/transaction.c')
-rw-r--r-- | src/transaction.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/transaction.c b/src/transaction.c index 816e125..31c4637 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -575,8 +575,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) continue; if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2)) continue; - queue_push(ti, p); - queue_push(ti, p2); + queue_push2(ti, p, p2); } if (s->obsoletes && !noobs) { @@ -592,24 +591,27 @@ create_transaction_info(Transaction *trans, Queue *decisionq) continue; if (pool->obsoleteusescolors && !pool_colormatch(pool, s, s2)) continue; - queue_push(ti, p); - queue_push(ti, p2); + queue_push2(ti, p, p2); } } } } - solv_sort(ti->elements, ti->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); - /* now unify */ - for (i = j = 0; i < ti->count; i += 2) + if (ti->count > 2) { - if (j && ti->elements[i] == ti->elements[j - 2] && ti->elements[i + 1] == ti->elements[j - 1]) - continue; - ti->elements[j++] = ti->elements[i]; - ti->elements[j++] = ti->elements[i + 1]; + /* sort and unify */ + solv_sort(ti->elements, ti->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); + for (i = j = 2; i < ti->count; i += 2) + { + if (ti->elements[i] == ti->elements[j - 2] && ti->elements[i + 1] == ti->elements[j - 1]) + continue; + ti->elements[j++] = ti->elements[i]; + ti->elements[j++] = ti->elements[i + 1]; + } + queue_truncate(ti, j); } - ti->count = j; /* create transaction_installed helper */ + /* entry > 0: exactly one obsoleter, entry < 0: multiple obsoleters, -entry is "best" */ trans->transaction_installed = solv_calloc(installed->end - installed->start, sizeof(Id)); for (i = 0; i < ti->count; i += 2) { @@ -618,7 +620,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) trans->transaction_installed[j] = ti->elements[i]; else { - /* more than one package obsoletes us. compare */ + /* more than one package obsoletes us. compare to find "best" */ Id q[4]; if (trans->transaction_installed[j] > 0) trans->transaction_installed[j] = -trans->transaction_installed[j]; |