Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate multiple subsequent choicerule_find_installed calls #545

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -3394,15 +3394,10 @@ solver_choicerulecheck(Solver *solv, Id pi, Rule *r, Map *m, Queue *q)
}

static Id
choicerule_find_installed(Pool *pool, Id p)
choicerule_find_installed(Pool *pool, Solvable *s)
{
Solvable *s = pool->solvables + p;
Id p2, pp2;

if (!s->repo)
return 0;
if (s->repo == pool->installed)
return p;
FOR_PROVIDES(p2, pp2, s->name)
{
Solvable *s2 = pool->solvables + p2;
Expand Down Expand Up @@ -3485,6 +3480,7 @@ solver_addchoicerules(Solver *solv)
queue_empty(&qi);
havechoice = 0;
isinstalled = 0;
Id name = 0;
FOR_RULELITERALS(p, pp, r)
{
if (p < 0)
Expand All @@ -3507,7 +3503,11 @@ solver_addchoicerules(Solver *solv)
continue;
}
/* find an installed package p2 that we can update/downgrade to p */
p2 = choicerule_find_installed(pool, p);
if (name != s->name)
{
p2 = choicerule_find_installed(pool, s);
name = s->name;
}
if (p2)
{
if (MAPTST(&mneg, p))
Expand Down