Author: mlandres
Date: Tue Jan 29 20:34:46 2008
New Revision: 8394
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8394&view=rev
Log:
remove superfluous Pool argument in policy_illegal_ functions
Modified:
trunk/sat-solver/src/policy.c
trunk/sat-solver/src/policy.h
trunk/sat-solver/src/solver.c
trunk/sat-solver/src/util.h
Modified: trunk/sat-solver/src/policy.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/policy.c?rev=8394&r1=8393&r2=8394&view=diff
==============================================================================
--- trunk/sat-solver/src/policy.c (original)
+++ trunk/sat-solver/src/policy.c Tue Jan 29 20:34:46 2008
@@ -7,7 +7,7 @@
/*
* Generic policy interface for SAT solver
- *
+ *
*/
#include
@@ -205,10 +205,10 @@
/*
* prune_best_version_arch
- *
+ *
* sort list of packages (given through plist) by name and evr
* return result through plist
- *
+ *
*/
/* FIXME: should prefer installed if identical version */
@@ -302,7 +302,7 @@
{ /* The application is responsible for */
return solv->bestSolvableCb (plist);
}
-
+
if (plist->count > 1)
prune_to_best_arch(pool, plist);
if (plist->count > 1)
@@ -321,14 +321,15 @@
/* FIXME: do this different! */
if (inst)
queue_push(plist, inst);
-
+
prune_best_version_arch (solv, pool, plist);
}
int
-policy_illegal_archchange(Solver *solv, Pool *pool, Solvable *s1, Solvable *s2)
+policy_illegal_archchange(Solver *solv, Solvable *s1, Solvable *s2)
{
+ Pool *pool = solv->pool;
Id a1 = s1->arch, a2 = s2->arch;
if (solv && solv->archCheckCb)
@@ -349,15 +350,16 @@
}
int
-policy_illegal_vendorchange(Solver *solv, Pool *pool, Solvable *s1, Solvable *s2)
+policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2)
{
+ Pool *pool = solv->pool;
Id vendormask1, vendormask2;
if (solv && solv->vendorCheckCb)
{ /* The application is responsible for */
return solv->vendorCheckCb (s1, s2);
}
-
+
if (s1->vendor == s2->vendor)
return 0;
vendormask1 = pool_vendor2mask(pool, s1->vendor);
@@ -385,7 +387,7 @@
{ /* The application is responsible for */
return solv->updateCandidateCb (s, qs);
}
-
+
/*
* s = solvable ptr
* n = solvable Id
@@ -408,9 +410,9 @@
{
if (!solv->allowdowngrade && evrcmp(pool, s->evr, ps->evr, EVRCMP_MATCH_RELEASE) > 0)
continue;
- if (!solv->allowarchchange && s->arch != ps->arch && policy_illegal_archchange(solv, pool, s, ps))
+ if (!solv->allowarchchange && s->arch != ps->arch && policy_illegal_archchange(solv, s, ps))
continue;
- if (!solv->allowvendorchange && s->vendor != ps->vendor && policy_illegal_vendorchange(solv, pool, s, ps))
+ if (!solv->allowvendorchange && s->vendor != ps->vendor && policy_illegal_vendorchange(solv, s, ps))
continue;
}
}
Modified: trunk/sat-solver/src/policy.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/policy.h?rev=8394&r1=8393&r2=8394&view=diff
==============================================================================
--- trunk/sat-solver/src/policy.h (original)
+++ trunk/sat-solver/src/policy.h Tue Jan 29 20:34:46 2008
@@ -7,7 +7,7 @@
/*
* Generic policy interface for SAT solver
- *
+ *
*/
#include "solver.h"
@@ -20,8 +20,8 @@
extern void policy_filter_unwanted(Solver *solv, Queue *plist, Id inst, int mode);
-extern int policy_illegal_archchange(Solver *solv, Pool *pool, Solvable *s1, Solvable *s2);
-extern int policy_illegal_vendorchange(Solver *solv, Pool *pool, Solvable *s1, Solvable *s2);
+extern int policy_illegal_archchange(Solver *solv, Solvable *s1, Solvable *s2);
+extern int policy_illegal_vendorchange(Solver *solv, Solvable *s1, Solvable *s2);
extern void policy_findupdatepackages(Solver *solv,
Solvable *s,
Queue *qs,
Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=8394&r1=8393&r2=8394&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Tue Jan 29 20:34:46 2008
@@ -169,7 +169,7 @@
for (i = 0; ; i++)
{
if (i == 0)
- /* print direct literal */
+ /* print direct literal */
v = r->p;
else if (r->d == ID_NULL)
{
@@ -224,7 +224,7 @@
Rule *b = (Rule *)bp;
Id *ad, *bd;
int x;
-
+
x = a->p - b->p;
if (x)
return x; /* p differs */
@@ -317,7 +317,7 @@
POOL_DEBUG(SAT_DEBUG_STATS, " binary: %d\n", binr);
POOL_DEBUG(SAT_DEBUG_STATS, " normal: %d, %d literals\n", solv->nrules - 1 - binr, lits);
}
- POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- unifyrules end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- unifyrules end -----\n");
}
#if 0
@@ -333,7 +333,7 @@
int *dp;
if (n <= 1)
- return (x * 37) ^ (unsigned int)d;
+ return (x * 37) ^ (unsigned int)d;
dp = solv->pool->whatprovidesdata + d;
while (*dp)
x = (x * 37) ^ (unsigned int)*dp++;
@@ -349,16 +349,16 @@
*
*
* A requires b, b provided by B1,B2,B3 => (-A|B1|B2|B3)
- *
+ *
* p < 0 : pkg id of A
* d > 0 : Offset in whatprovidesdata (list of providers of b)
- *
+ *
* A conflicts b, b provided by B1,B2,B3 => (-A|-B1), (-A|-B2), (-A|-B3)
* p < 0 : pkg id of A
* d < 0 : Id of solvable (e.g. B1)
- *
+ *
* d == 0: unary rule, assertion => (A) or (-A)
- *
+ *
* Install: p > 0, d = 0 (A) user requested install
* Remove: p < 0, d = 0 (-A) user requested remove
* Requires: p < 0, d > 0 (-A|B1|B2|...) d: <list of providers for requirement of p>
@@ -456,7 +456,7 @@
if (*dp == *dp2)
return r;
}
-
+
/*
* allocate new rule
*/
@@ -494,7 +494,7 @@
POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " Add rule: ");
printrule(solv, SAT_DEBUG_RULE_CREATION, r);
}
-
+
return r;
}
@@ -521,7 +521,7 @@
* consisting of multiple job rules.
*/
-static void
+static void
disableproblem(Solver *solv, Id v)
{
Rule *r;
@@ -540,7 +540,7 @@
disablerule(solv, r);
}
-static void
+static void
enableproblem(Solver *solv, Id v)
{
Rule *r;
@@ -602,7 +602,7 @@
int decisionstart;
POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- makeruledecisions ; size decisionq: %d -----\n",solv->decisionq.count);
-
+
decisionstart = solv->decisionq.count;
/* rpm rules don't have assertions, so we can start with the job
* rules */
@@ -706,7 +706,7 @@
ri = solv->jobrules - 1;
r = solv->rules + ri;
}
-
+
POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- makeruledecisions end; size decisionq: %d -----\n",solv->decisionq.count);
}
@@ -984,7 +984,7 @@
Id n;
POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforsolvable -----\n");
-
+
queue_init_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
queue_push(&q, s - pool->solvables); /* push solvable Id */
@@ -994,7 +994,7 @@
* n: Id of solvable
* s: Pointer to solvable
*/
-
+
n = queue_shift(&q);
if (MAPTST(m, n)) /* continue if already done */
continue;
@@ -1027,7 +1027,7 @@
/*-----------------------------------------
* check requires of s
*/
-
+
if (s->requires)
{
reqp = s->repo->idarraydata + s->requires;
@@ -1099,11 +1099,11 @@
/* that's all we check for src packages */
if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
continue;
-
+
/*-----------------------------------------
* check conflicts of s
*/
-
+
if (s->conflicts)
{
conp = s->repo->idarraydata + s->conflicts;
@@ -1214,7 +1214,7 @@
addrpmrulesforsolvable(solv, s, m);
n = 0;
}
- POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforweak end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforweak end -----\n");
}
static void
@@ -1230,19 +1230,19 @@
queue_init_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
policy_findupdatepackages(solv, s, &qs, allowall);
if (!MAPTST(m, s - pool->solvables)) /* add rule for s if not already done */
- addrpmrulesforsolvable(solv, s, m);
+ addrpmrulesforsolvable(solv, s, m);
for (i = 0; i < qs.count; i++)
if (!MAPTST(m, qs.elements[i]))
addrpmrulesforsolvable(solv, pool->solvables + qs.elements[i], m);
queue_free(&qs);
-
+
POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addrpmrulesforupdaters -----\n");
}
/*
* add rule for update
* (A|A1|A2|A3...) An = update candidates for A
- *
+ *
* s = (installed) solvable
*/
@@ -1265,7 +1265,7 @@
d = pool_queuetowhatprovides(pool, &qs); /* intern computed queue */
queue_free(&qs);
addrule(solv, s - pool->solvables, d); /* allow update of s */
- POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addupdaterule end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- addupdaterule end -----\n");
}
@@ -1282,7 +1282,7 @@
{
Pool *pool = solv->pool;
int counter;
-
+
POOL_DEBUG(type, "Watches: \n");
for (counter = -(pool->nsolvables); counter <= pool->nsolvables; counter ++)
@@ -1293,7 +1293,7 @@
/*
* makewatches
- *
+ *
* initial setup for all watches
*/
@@ -1352,7 +1352,7 @@
/*
* propagate
- *
+ *
* propagate decision to all rules
* return : 0 = everything is OK
* watched rule = there is a conflict
@@ -1386,13 +1386,13 @@
for (rp = watches + pkg; *rp; rp = nrp)
{
r = solv->rules + *rp;
-
+
IF_POOLDEBUG (SAT_DEBUG_PROPAGATE)
{
POOL_DEBUG(SAT_DEBUG_PROPAGATE," watch triggered ");
printrule(solv, SAT_DEBUG_PROPAGATE, r);
}
-
+
if (pkg == r->w1)
{
ow = r->w2; /* regard the second watchpoint to come to a solution */
@@ -1469,7 +1469,7 @@
}
}
POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate end-----\n");
-
+
return 0; /* all is well */
}
@@ -1494,7 +1494,7 @@
int num = 0, l1num = 0;
int learnt_why = solv->learnt_pool.count;
Id *decisionmap = solv->decisionmap;
-
+
queue_init(&r);
POOL_DEBUG(SAT_DEBUG_ANALYZE, "ANALYZE at %d ----------------------\n", level);
@@ -1572,7 +1572,7 @@
why = solv->decisionq_why.elements[idx];
if (!why)
{
- queue_push(&solv->learnt_pool, -vv);
+ queue_push(&solv->learnt_pool, -vv);
IF_POOLDEBUG (SAT_DEBUG_ANALYZE)
{
POOL_DEBUG(SAT_DEBUG_ANALYZE, "RPM ASSERT Rule:\n");
@@ -2100,7 +2100,7 @@
/*
* run_solver
- *
+ *
* all rules have been set up, now actually run the solver
*
*/
@@ -2125,7 +2125,7 @@
}
POOL_DEBUG(SAT_DEBUG_STATS, "initial decisions: %d\n", solv->decisionq.count);
-
+
IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
printdecisions(solv);
@@ -2140,7 +2140,7 @@
/*
* propagate
*/
-
+
if (level == 1)
{
POOL_DEBUG(SAT_DEBUG_PROPAGATE, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count);
@@ -2156,7 +2156,7 @@
/*
* installed packages
*/
-
+
if (level < systemlevel && solv->installed && solv->installed->nsolvables)
{
if (!solv->updatesystem)
@@ -2237,7 +2237,7 @@
/*
* decide
*/
-
+
POOL_DEBUG(SAT_DEBUG_STATS, "deciding unresolved rules\n");
for (i = 1, n = 1; ; i++, n++)
{
@@ -2322,7 +2322,7 @@
if (n != solv->nrules) /* continue if level < systemlevel */
continue;
-
+
if (doweak && !solv->problems.count)
{
int qcount;
@@ -2474,14 +2474,14 @@
queue_free(&dq);
}
-
+
/*
* refine_suggestion
* at this point, all rules that led to conflicts are disabled.
* we re-enable all rules of a problem set but rule "sug", then
* continue to disable more rules until there as again a solution.
*/
-
+
/* FIXME: think about conflicting assertions */
static void
@@ -2819,7 +2819,7 @@
/*
* printdecisions
*/
-
+
void
printdecisions(Solver *solv)
@@ -2830,7 +2830,7 @@
int i;
Solvable *s;
- POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- Decisions -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- Decisions -----\n");
/* print solvables to be erased */
@@ -2855,9 +2855,9 @@
if (p < 0)
{
IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
- {
+ {
p = -p;
- s = pool->solvables + p;
+ s = pool->solvables + p;
POOL_DEBUG(SAT_DEBUG_SCHUBI, "level of %s is %d\n", solvable2str(pool, s), p);
}
continue;
@@ -2898,7 +2898,7 @@
POOL_DEBUG(SAT_DEBUG_RESULT, "- %s\n", solvable2str(pool, s));
}
}
- POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- Decisions end -----\n");
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "----- Decisions end -----\n");
}
/* this is basically the reverse of addrpmrulesforsolvable */
@@ -2911,7 +2911,7 @@
Solvable *s;
int dontfix = 0;
Id p, *pp, req, *reqp, con, *conp, obs, *obsp, *dp;
-
+
assert(rid < solv->weakrules);
if (rid >= solv->systemrules)
{
@@ -2922,7 +2922,7 @@
}
if (rid >= solv->jobrules)
{
-
+
r = solv->rules + rid;
p = solv->ruletojob.elements[rid - solv->jobrules];
*depp = job->elements[p + 1];
@@ -2996,7 +2996,7 @@
conp = s->repo->idarraydata + s->conflicts;
while ((con = *conp++) != 0)
{
- FOR_PROVIDES(p, pp, con)
+ FOR_PROVIDES(p, pp, con)
{
if (dontfix && pool->solvables[p].repo == installed)
continue;
@@ -3014,7 +3014,7 @@
conp = s2->repo->idarraydata + s2->conflicts;
while ((con = *conp++) != 0)
{
- FOR_PROVIDES(p, pp, con)
+ FOR_PROVIDES(p, pp, con)
{
if (dontfix2 && pool->solvables[p].repo == installed)
continue;
@@ -3293,12 +3293,12 @@
POOL_DEBUG(SAT_DEBUG_RESULT, "- allow downgrade of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd));
gotone = 1;
}
- if (!solv->allowarchchange && s->name == sd->name && s->arch != sd->arch && policy_illegal_archchange(solv, pool, s, sd))
+ if (!solv->allowarchchange && s->name == sd->name && s->arch != sd->arch && policy_illegal_archchange(solv, s, sd))
{
POOL_DEBUG(SAT_DEBUG_RESULT, "- allow architecture change of %s to %s\n", solvable2str(pool, s), solvable2str(pool, sd));
gotone = 1;
}
- if (!solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && policy_illegal_vendorchange(solv,pool, s, sd))
+ if (!solv->allowvendorchange && s->name == sd->name && s->vendor != sd->vendor && policy_illegal_vendorchange(solv, s, sd))
{
if (sd->vendor)
POOL_DEBUG(SAT_DEBUG_RESULT, "- allow vendor change from '%s' (%s) to '%s' (%s)\n", id2str(pool, s->vendor), solvable2str(pool, s), id2str(pool, sd->vendor), solvable2str(pool, sd));
@@ -3427,12 +3427,12 @@
/*
* create basic rule set of all involved packages
* use addedmap bitmap to make sure we don't create rules twice
- *
+ *
*/
map_init(&addedmap, pool->nsolvables);
queue_init(&q);
-
+
/*
* always install our system solvable
*/
@@ -3444,7 +3444,7 @@
/*
* create rules for all package that could be involved with the solving
* so called: rpm rules
- *
+ *
*/
if (installed)
{
@@ -3516,20 +3516,20 @@
* at this point the system is always solvable,
* as an empty system (remove all packages) is a valid solution
*/
-
+
unifyrules(solv); /* remove duplicate rpm rules */
solv->directdecisions = solv->decisionq.count;
POOL_DEBUG(SAT_DEBUG_STATS, "decisions so far: %d\n", solv->decisionq.count);
- IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
+ IF_POOLDEBUG (SAT_DEBUG_SCHUBI)
printdecisions (solv);
/*
* now add all job rules
*/
- POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** Add JOB rules ***\n");
-
+ POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** Add JOB rules ***\n");
+
solv->jobrules = solv->nrules;
for (i = 0; i < job->count; i += 2)
@@ -3566,7 +3566,7 @@
continue;
queue_push(&q, p);
}
- if (!q.count)
+ if (!q.count)
{
/* no provider, make this an impossible rule */
queue_push(&q, -SYSTEMSOLVABLE);
@@ -3618,19 +3618,19 @@
/*
* now add system rules
- *
+ *
*/
POOL_DEBUG(SAT_DEBUG_SCHUBI, "*** Add system rules ***\n");
-
-
+
+
solv->systemrules = solv->nrules;
/*
* create rules for updating installed solvables
- *
+ *
*/
-
+
if (installed && !solv->allowuninstall)
{ /* loop over all installed solvables */
/* we create all update rules, but disable some later on depending on the job */
Modified: trunk/sat-solver/src/util.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/util.h?rev=8394&r1=8393&r2=8394&view=diff
==============================================================================
--- trunk/sat-solver/src/util.h (original)
+++ trunk/sat-solver/src/util.h Tue Jan 29 20:34:46 2008
@@ -7,12 +7,14 @@
/*
* util.h
- *
+ *
*/
#ifndef SATSOLVER_UTIL_H
#define SATSOLVER_UTIL_H
+#include
+
extern void *sat_malloc(size_t);
extern void *sat_malloc2(size_t, size_t);
extern void *sat_calloc(size_t, size_t);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org