Author: mlschroe
Date: Mon Oct 29 16:00:30 2007
New Revision: 7686
URL: http://svn.opensuse.org/viewcvs/zypp?rev=7686&view=rev
Log:
- rename queue* to queue_*, inline a bit more
- rename map* to map_*
Modified:
trunk/sat-solver/bindings/satsolver.i
trunk/sat-solver/src/bitmap.c
trunk/sat-solver/src/bitmap.h
trunk/sat-solver/src/pool.c
trunk/sat-solver/src/queue.c
trunk/sat-solver/src/queue.h
trunk/sat-solver/src/solver.c
trunk/sat-solver/testsuite/deptestomatic.c
trunk/sat-solver/testsuite/yps.c
Modified: trunk/sat-solver/bindings/satsolver.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/satsolver.i?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/bindings/satsolver.i (original)
+++ trunk/sat-solver/bindings/satsolver.i Mon Oct 29 16:00:30 2007
@@ -81,7 +81,7 @@
pool = $self;
id = str2id(pool, name, 1);
- queueinit( &plist);
+ queue_init( &plist);
i = repo ? repo->start : 1;
end = repo ? repo->start + repo->nsolvables : pool->nsolvables;
for (; i < end; i++)
@@ -90,7 +90,7 @@
if (!pool_installable(pool, s))
continue;
if (s->name == id)
- queuepush(&plist, i);
+ queue_push(&plist, i);
}
prune_best_version_arch(pool, &plist);
@@ -102,7 +102,7 @@
}
id = plist.elements[0];
- queuefree(&plist);
+ queue_free(&plist);
return pool->solvables + id;
}
@@ -128,25 +128,25 @@
%extend Queue {
Queue()
- { Queue *q = new Queue(); queueinit(q); return q; }
+ { Queue *q = new Queue(); queue_init(q); return q; }
~Queue()
- { queuefree($self); }
+ { queue_free($self); }
Queue* clone()
- { Queue *t; clonequeue(t, $self); return t; }
+ { Queue *t; queue_clone(t, $self); return t; }
Id shift()
- { return queueshift($self); }
+ { return queue_shift($self); }
void push(Id id)
- { /*printf("push id\n");*/ queuepush($self, id); }
+ { /*printf("push id\n");*/ queue_push($self, id); }
void push( Solvable *s )
- { /*printf("push solvable\n");*/ queuepush($self, (s - s->repo->pool->solvables)); }
+ { /*printf("push solvable\n");*/ queue_push($self, (s - s->repo->pool->solvables)); }
void push_unique(Id id)
- { queuepushunique($self, id); }
+ { queue_pushunique($self, id); }
%rename("empty?") empty();
bool empty()
@@ -155,8 +155,8 @@
void clear()
{ QUEUEEMPTY($self); }
};
-%newobject queueinit;
-%delobject queuefree;
+%newobject queue_init;
+%delobject queue_free;
%include "solvable.h"
Modified: trunk/sat-solver/src/bitmap.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/bitmap.c?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/src/bitmap.c (original)
+++ trunk/sat-solver/src/bitmap.c Mon Oct 29 16:00:30 2007
@@ -10,7 +10,7 @@
#include "util.h"
void
-mapinit(Map *m, int n)
+map_init(Map *m, int n)
{
m->size = (n + 7) >> 3;
m->map = xcalloc(m->size, 1);
@@ -18,7 +18,7 @@
// free space allocated
void
-mapfree(Map *m)
+map_free(Map *m)
{
m->map = xfree(m->map);
m->size = 0;
@@ -26,7 +26,7 @@
// copy t <- s
void
-clonemap(Map *t, Map *s)
+map_clone(Map *t, Map *s)
{
t->size = s->size;
t->map = xmalloc(s->size);
Modified: trunk/sat-solver/src/bitmap.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/bitmap.h?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/src/bitmap.h (original)
+++ trunk/sat-solver/src/bitmap.h Mon Oct 29 16:00:30 2007
@@ -11,17 +11,13 @@
int size;
} Map;
-#if 0
-#define MAPINIT(m, n) ((m)->size = ((n) + 7) >> 3, (m)->map = calloc((m)->size, 1))
-#endif
-
#define MAPZERO(m) (memset((m)->map, 0, (m)->size))
#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7))
#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7)))
#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7)))
-extern void mapinit(Map *m, int n);
-extern void mapfree(Map *m);
-extern void clonemap(Map *t, Map *s);
+extern void map_init(Map *m, int n);
+extern void map_free(Map *m);
+extern void map_clone(Map *t, Map *s);
#endif /* BITMAP_H */
Modified: trunk/sat-solver/src/pool.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/src/pool.c (original)
+++ trunk/sat-solver/src/pool.c Mon Oct 29 16:00:30 2007
@@ -425,7 +425,7 @@
Id p, *pp, *pp2, *pp3;
d = GETRELID(pool, d);
- queueinit_buffer(&plist, buf, sizeof(buf)/sizeof(*buf));
+ queue_init_buffer(&plist, buf, sizeof(buf)/sizeof(*buf));
switch (flags)
{
case REL_AND:
@@ -437,7 +437,7 @@
for (pp3 = pp2; *pp3;)
if (*pp3++ == p)
{
- queuepush(&plist, p);
+ queue_push(&plist, p);
break;
}
}
@@ -445,10 +445,10 @@
case REL_OR:
pp = GET_PROVIDESP(name, p);
while ((p = *pp++) != 0)
- queuepush(&plist, p);
+ queue_push(&plist, p);
pp = GET_PROVIDESP(evr, p);
while ((p = *pp++) != 0)
- queuepushunique(&plist, p);
+ queue_pushunique(&plist, p);
break;
case REL_NAMESPACE:
if (pool->nscallback)
@@ -456,12 +456,12 @@
p = pool->nscallback(pool, pool->nscallbackdata, name, evr);
if (p > 1)
{
- queuefree(&plist);
+ queue_free(&plist);
pool->whatprovides[d] = p;
return pool->whatprovidesdata + p;
}
if (p == 1)
- queuepush(&plist, SYSTEMSOLVABLE);
+ queue_push(&plist, SYSTEMSOLVABLE);
}
break;
default:
@@ -518,18 +518,18 @@
}
if (!pid)
continue; /* no rel match */
- queuepush(&plist, p);
+ queue_push(&plist, p);
}
/* make our system solvable provide all unknown rpmlib() stuff */
if (plist.count == 0 && !strncmp(id2str(pool, name), "rpmlib(", 7))
- queuepush(&plist, SYSTEMSOLVABLE);
+ queue_push(&plist, SYSTEMSOLVABLE);
}
/* add providers to whatprovides */
#if 0
if (pool->verbose) printf("addrelproviders: adding %d packages to %d\n", plist.count, d);
#endif
pool->whatprovides[d] = pool_queuetowhatprovides(pool, &plist);
- queuefree(&plist);
+ queue_free(&plist);
return pool->whatprovidesdata + pool->whatprovides[d];
}
Modified: trunk/sat-solver/src/queue.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/queue.c?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/src/queue.c (original)
+++ trunk/sat-solver/src/queue.c Mon Oct 29 16:00:30 2007
@@ -7,11 +7,12 @@
#include
#include "queue.h"
+#include "util.h"
void
-clonequeue(Queue *t, Queue *s)
+queue_clone(Queue *t, Queue *s)
{
- t->alloc = t->elements = malloc((s->count + 8) * sizeof(Id));
+ t->alloc = t->elements = xmalloc((s->count + 8) * sizeof(Id));
if (s->count)
memcpy(t->alloc, s->elements, s->count * sizeof(Id));
t->count = s->count;
@@ -19,14 +20,14 @@
}
void
-queueinit(Queue *q)
+queue_init(Queue *q)
{
q->alloc = q->elements = 0;
q->count = q->left = 0;
}
void
-queueinit_buffer(Queue *q, Id *buf, int size)
+queue_init_buffer(Queue *q, Id *buf, int size)
{
q->alloc = 0;
q->elements = buf;
@@ -35,7 +36,7 @@
}
void
-queuefree(Queue *q)
+queue_free(Queue *q)
{
if (q->alloc)
free(q->alloc);
@@ -43,52 +44,27 @@
q->count = q->left = 0;
}
-Id
-queueshift(Queue *q)
-{
- if (!q->count)
- return 0;
- q->count--;
- return *q->elements++;
-}
-
void
-queuepush(Queue *q, Id id)
+queue_alloc_one(Queue *q)
{
- if (!q->left)
+ if (q->alloc && q->alloc != q->elements)
{
- if (q->alloc && q->alloc != q->elements)
- {
- memmove(q->alloc, q->elements, q->count * sizeof(Id));
- q->left += q->elements - q->alloc;
- q->elements = q->alloc;
- }
- else if (q->alloc)
- {
- q->elements = q->alloc = realloc(q->alloc, (q->count + 8) * sizeof(Id));
- q->left += 8;
- }
- else
- {
- q->alloc = malloc((q->count + 8) * sizeof(Id));
- if (q->count)
- memcpy(q->alloc, q->elements, q->count * sizeof(Id));
- q->elements = q->alloc;
- q->left += 8;
- }
+ memmove(q->alloc, q->elements, q->count * sizeof(Id));
+ q->left += q->elements - q->alloc;
+ q->elements = q->alloc;
+ }
+ else if (q->alloc)
+ {
+ q->elements = q->alloc = realloc(q->alloc, (q->count + 8) * sizeof(Id));
+ q->left += 8;
+ }
+ else
+ {
+ q->alloc = xmalloc((q->count + 8) * sizeof(Id));
+ if (q->count)
+ memcpy(q->alloc, q->elements, q->count * sizeof(Id));
+ q->elements = q->alloc;
+ q->left += 8;
}
- q->elements[q->count++] = id;
- q->left--;
-}
-
-void
-queuepushunique(Queue *q, Id id)
-{
- int i;
- for (i = q->count; i > 0; )
- if (q->elements[--i] == id)
- return;
- queuepush(q, id);
}
-
Modified: trunk/sat-solver/src/queue.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/queue.h?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/src/queue.h (original)
+++ trunk/sat-solver/src/queue.h Mon Oct 29 16:00:30 2007
@@ -15,16 +15,54 @@
int left; // space left in alloc *after* elements+count
} Queue;
+
+extern void queue_alloc_one(Queue *q);
+
// clear queue
+static inline void
+queue_empty(Queue *q)
+{
+ if (q->alloc)
+ {
+ q->left += (q->elements - q->alloc) + q->count;
+ q->elements = q->alloc;
+ }
+ else
+ q->left += q->count;
+ q->count = 0;
+}
+
+static inline Id
+queue_shift(Queue *q)
+{
+ if (!q->count)
+ return 0;
+ q->count--;
+ return *q->elements++;
+}
+
+static inline void
+queue_push(Queue *q, Id id)
+{
+ if (!q->left)
+ queue_alloc_one(q);
+ q->elements[q->count++] = id;
+ q->left--;
+}
-#define QUEUEEMPTY(q) ((q)->alloc ? ((q)->left += ((q)->elements - (q)->alloc) + (q)->count, (q)->elements = (q)->alloc, (q)->count = 0) : ((q)->left += (q)->count, (q)->count = 0))
+static inline void
+queue_pushunique(Queue *q, Id id)
+{
+ int i;
+ for (i = q->count; i > 0; )
+ if (q->elements[--i] == id)
+ return;
+ queue_push(q, id);
+}
-extern void clonequeue(Queue *t, Queue *s);
-extern void queueinit(Queue *q);
-extern void queueinit_buffer(Queue *q, Id *buf, int size);
-extern void queuefree(Queue *q);
-extern Id queueshift(Queue *q);
-extern void queuepush(Queue *q, Id id);
-extern void queuepushunique(Queue *q, Id id);
+extern void queue_clone(Queue *t, Queue *s);
+extern void queue_init(Queue *q);
+extern void queue_init_buffer(Queue *q, Id *buf, int size);
+extern void queue_free(Queue *q);
#endif /* QUEUE_H */
Modified: trunk/sat-solver/src/solver.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/solver.c?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/src/solver.c (original)
+++ trunk/sat-solver/src/solver.c Mon Oct 29 16:00:30 2007
@@ -632,8 +632,8 @@
abort();
if (solv->decisionmap[-p])
return NULL;
- queuepush(&solv->decisionq, p);
- queuepush(&solv->decisionq_why, 0);
+ queue_push(&solv->decisionq, p);
+ queue_push(&solv->decisionq_why, 0);
solv->decisionmap[-p] = -1;
return 0;
}
@@ -726,8 +726,8 @@
vv = v > 0 ? v : -v;
if (solv->decisionmap[vv] == 0)
{
- queuepush(&solv->decisionq, v);
- queuepush(&solv->decisionq_why, r - solv->rules);
+ queue_push(&solv->decisionq, v);
+ queue_push(&solv->decisionq_why, r - solv->rules);
solv->decisionmap[vv] = v > 0 ? 1 : -1;
continue;
}
@@ -753,8 +753,8 @@
{
/* conflict with rpm rule, need only disable our rule */
printf("conflict with rpm rule, disabling rule #%d\n", ri);
- queuepush(&solv->problems, r - solv->rules);
- queuepush(&solv->problems, 0);
+ queue_push(&solv->problems, r - solv->rules);
+ queue_push(&solv->problems, 0);
r->w1 = 0; /* disable */
continue;
}
@@ -777,10 +777,10 @@
if (rr->p != v && rr->p != -v)
continue;
printf(" - disabling rule #%d\n", i);
- queuepush(&solv->problems, i);
+ queue_push(&solv->problems, i);
rr->w1 = 0; /* disable */
}
- queuepush(&solv->problems, 0);
+ queue_push(&solv->problems, 0);
}
}
@@ -808,8 +808,8 @@
Id *dp;
Id n;
- queueinit_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
- queuepush(&q, s - pool->solvables); /* push solvable Id */
+ queue_init_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
+ queue_push(&q, s - pool->solvables); /* push solvable Id */
while (q.count)
{
@@ -818,7 +818,7 @@
* s: Pointer to solvable
*/
- n = queueshift(&q);
+ n = queue_shift(&q);
if (MAPTST(m, n)) /* continue if already done */
continue;
@@ -894,7 +894,7 @@
for (; *dp; dp++) /* loop through all providers */
{
if (!MAPTST(m, *dp))
- queuepush(&q, *dp);
+ queue_push(&q, *dp);
}
} /* while, requirements of n */
@@ -953,7 +953,7 @@
{
FOR_PROVIDES(p, pp, rec)
if (!MAPTST(m, p))
- queuepush(&q, p);
+ queue_push(&q, p);
}
}
if (s->suggests)
@@ -963,11 +963,11 @@
{
FOR_PROVIDES(p, pp, sug)
if (!MAPTST(m, p))
- queuepush(&q, p);
+ queue_push(&q, p);
}
}
}
- queuefree(&q);
+ queue_free(&q);
}
static void
@@ -1045,7 +1045,7 @@
Id obs, *obsp;
Solvable *ps;
- QUEUEEMPTY(qs);
+ queue_empty(qs);
/*
* s = solvable ptr
* n = solvable Id
@@ -1093,7 +1093,7 @@
}
else
continue;
- queuepush(qs, p);
+ queue_push(qs, p);
if (m && !MAPTST(m, p)) /* mark p for install if not already done */
addrulesforsolvable(solv, pool->solvables + p, m);
@@ -1102,7 +1102,7 @@
{
for (pp = solv->obsoletes_data + solv->obsoletes[n - solv->system->start]; (p = *pp++) != 0;)
{
- queuepush(qs, p);
+ queue_push(qs, p);
if (m && !MAPTST(m, p)) /* mark p for install if not already done */
addrulesforsolvable(solv, pool->solvables + p, m);
}
@@ -1127,12 +1127,12 @@
Queue qs;
Id qsbuf[64];
- queueinit_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
+ queue_init_buffer(&qs, qsbuf, sizeof(qsbuf)/sizeof(*qsbuf));
findupdatepackages(solv, s, &qs, m, allowdowngrade, allowarchchange);
p = s - pool->solvables;
if (dontaddrule) /* we consider update candidates but dont force them */
{
- queuefree(&qs);
+ queue_free(&qs);
return;
}
@@ -1142,12 +1142,12 @@
printf("new update rule: must keep %s-%s.%s\n", id2str(pool, s->name), id2str(pool, s->evr), id2str(pool, s->arch));
#endif
addrule(solv, p, 0); /* request 'install' of s */
- queuefree(&qs);
+ queue_free(&qs);
return;
}
d = pool_queuetowhatprovides(pool, &qs); /* intern computed provider queue */
- queuefree(&qs);
+ queue_free(&qs);
r = addrule(solv, p, d); /* allow update of s */
#if 0
printf("new update rule ");
@@ -1311,8 +1311,8 @@
decisionmap[ow] = level;
else
decisionmap[-ow] = -level;
- queuepush(&solv->decisionq, ow);
- queuepush(&solv->decisionq_why, r - solv->rules);
+ queue_push(&solv->decisionq, ow);
+ queue_push(&solv->decisionq_why, r - solv->rules);
#if 0
{
Solvable *s = pool->solvables + (ow > 0 ? ow : -ow);
@@ -1349,15 +1349,15 @@
int learnt_why = solv->learnt_pool.count;
Id *decisionmap = solv->decisionmap;
- queueinit(&r);
+ queue_init(&r);
if (pool->verbose) printf("ANALYZE at %d ----------------------\n", level);
- mapinit(&seen, pool->nsolvables);
+ map_init(&seen, pool->nsolvables);
idx = solv->decisionq.count;
for (;;)
{
printrule(solv, c);
- queuepush(&solv->learnt_pool, c - solv->rules);
+ queue_push(&solv->learnt_pool, c - solv->rules);
dp = c->d ? pool->whatprovidesdata + c->d : 0;
for (i = -1; ; i++)
{
@@ -1386,7 +1386,7 @@
break;
if (j == solv->decisionq.count)
abort();
- queuepush(&rulq, -(j + 1));
+ queue_push(&rulq, -(j + 1));
#endif
continue; /* initial setting */
}
@@ -1395,7 +1395,7 @@
num++; /* need to do this one as well */
else
{
- queuepush(&r, v);
+ queue_push(&r, v);
#if 0
printf("PUSH %d ", v);
printruleelement(solv, 0, v);
@@ -1438,8 +1438,8 @@
printruleelement(solv, 0, v);
}
}
- mapfree(&seen);
- queuepush(&solv->learnt_pool, 0);
+ map_free(&seen);
+ queue_push(&solv->learnt_pool, 0);
#if 0
for (i = learnt_why; solv->learnt_pool.elements[i]; i++)
{
@@ -1466,8 +1466,8 @@
/* delete all learnt rules */
solv->nrules = solv->learntrules;
- QUEUEEMPTY(&solv->learnt_why);
- QUEUEEMPTY(&solv->learnt_pool);
+ queue_empty(&solv->learnt_why);
+ queue_empty(&solv->learnt_pool);
/* redo all direct rpm rule decisions */
/* we break at the first decision with a why attached, this is
@@ -1541,7 +1541,7 @@
else if (solv->problems.elements[i] == why)
return;
}
- queuepush(&solv->problems, why);
+ queue_push(&solv->problems, why);
}
@@ -1567,7 +1567,7 @@
printf("ANALYZE UNSOLVABLE ----------------------\n");
#endif
oldproblemcount = solv->problems.count;
- mapinit(&seen, pool->nsolvables);
+ map_init(&seen, pool->nsolvables);
analyze_unsolvable_rule(solv, r);
dp = r->d ? pool->whatprovidesdata + r->d : 0;
for (i = -1; ; i++)
@@ -1626,8 +1626,8 @@
MAPSET(&seen, vv);
}
}
- mapfree(&seen);
- queuepush(&solv->problems, 0); /* mark end of this problem */
+ map_free(&seen);
+ queue_push(&solv->problems, 0); /* mark end of this problem */
lastweak = 0;
if (solv->weakrules != solv->learntrules)
@@ -1741,8 +1741,8 @@
solv->decisionmap[decision] = level;
else
solv->decisionmap[-decision] = -level;
- queuepush(&solv->decisionq, decision);
- queuepush(&solv->decisionq_why, 0);
+ queue_push(&solv->decisionq, decision);
+ queue_push(&solv->decisionq_why, 0);
}
for (;;)
{
@@ -1766,7 +1766,7 @@
printf("%d %d\n", solv->learnt_why.count, (int)(r - solv->rules) - solv->learntrules);
abort();
}
- queuepush(&solv->learnt_why, why);
+ queue_push(&solv->learnt_why, why);
if (d)
{
/* at least 2 literals, needs watches */
@@ -1774,8 +1774,8 @@
addwatches(solv, r);
}
solv->decisionmap[p > 0 ? p : -p] = p > 0 ? level : -level;
- queuepush(&solv->decisionq, p);
- queuepush(&solv->decisionq_why, r - solv->rules);
+ queue_push(&solv->decisionq, p);
+ queue_push(&solv->decisionq_why, r - solv->rules);
printf("decision: ");
printruleelement(solv, 0, p);
printf("new rule: ");
@@ -1809,16 +1809,16 @@
solv->system = system;
pool->verbose = 1;
- queueinit(&solv->ruletojob);
- queueinit(&solv->decisionq);
- queueinit(&solv->decisionq_why);
- queueinit(&solv->problems);
- queueinit(&solv->suggestions);
- queueinit(&solv->learnt_why);
- queueinit(&solv->learnt_pool);
+ queue_init(&solv->ruletojob);
+ queue_init(&solv->decisionq);
+ queue_init(&solv->decisionq_why);
+ queue_init(&solv->problems);
+ queue_init(&solv->suggestions);
+ queue_init(&solv->learnt_why);
+ queue_init(&solv->learnt_pool);
- mapinit(&solv->recommendsmap, pool->nsolvables);
- mapinit(&solv->suggestsmap, pool->nsolvables);
+ map_init(&solv->recommendsmap, pool->nsolvables);
+ map_init(&solv->suggestsmap, pool->nsolvables);
solv->recommends_index = 0;
solv->decisionmap = (Id *)xcalloc(pool->nsolvables, sizeof(Id));
@@ -1837,16 +1837,16 @@
void
solver_free(Solver *solv)
{
- queuefree(&solv->ruletojob);
- queuefree(&solv->decisionq);
- queuefree(&solv->decisionq_why);
- queuefree(&solv->learnt_why);
- queuefree(&solv->learnt_pool);
- queuefree(&solv->problems);
- queuefree(&solv->suggestions);
+ queue_free(&solv->ruletojob);
+ queue_free(&solv->decisionq);
+ queue_free(&solv->decisionq_why);
+ queue_free(&solv->learnt_why);
+ queue_free(&solv->learnt_pool);
+ queue_free(&solv->problems);
+ queue_free(&solv->suggestions);
- mapfree(&solv->recommendsmap);
- mapfree(&solv->suggestsmap);
+ map_free(&solv->recommendsmap);
+ map_free(&solv->suggestsmap);
xfree(solv->decisionmap);
xfree(solv->rules);
xfree(solv->watches);
@@ -1901,7 +1901,7 @@
systemlevel = level + 1;
if (pool->verbose) printf("solving...\n");
- queueinit(&dq);
+ queue_init(&dq);
for (;;)
{
/*
@@ -1916,7 +1916,7 @@
if (analyze_unsolvable(solv, r, disablerules))
continue;
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
}
@@ -1948,7 +1948,7 @@
if (level == 0)
{
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
if (level <= olevel)
@@ -1964,9 +1964,9 @@
break;
if (solv->decisionmap[i] > 0 || (solv->decisionmap[i] < 0 && solv->weaksystemrules[i - solv->system->start] == 0))
continue;
- QUEUEEMPTY(&dq);
+ queue_empty(&dq);
if (solv->decisionmap[i] == 0)
- queuepush(&dq, i);
+ queue_push(&dq, i);
if (solv->weaksystemrules[i - solv->system->start])
{
dp = pool->whatprovidesdata + solv->weaksystemrules[i - solv->system->start];
@@ -1975,7 +1975,7 @@
if (solv->decisionmap[p] > 0)
break;
if (solv->decisionmap[p] == 0)
- queuepush(&dq, p);
+ queue_push(&dq, p);
}
if (p)
continue; /* rule is already true */
@@ -1998,7 +1998,7 @@
if (level == 0)
{
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
if (level <= olevel)
@@ -2027,7 +2027,7 @@
r = solv->rules + i;
if (!r->w1)
continue;
- QUEUEEMPTY(&dq);
+ queue_empty(&dq);
if (r->d == 0)
{
/* binary or unary rule */
@@ -2036,8 +2036,8 @@
continue;
if (solv->decisionmap[r->p] || solv->decisionmap[r->w2])
continue;
- queuepush(&dq, r->p);
- queuepush(&dq, r->w2);
+ queue_push(&dq, r->p);
+ queue_push(&dq, r->w2);
}
else
{
@@ -2057,7 +2057,7 @@
if (solv->decisionmap[r->p] > 0)
continue;
if (solv->decisionmap[r->p] == 0)
- queuepush(&dq, r->p);
+ queue_push(&dq, r->p);
}
dp = pool->whatprovidesdata + r->d;
while ((p = *dp++) != 0)
@@ -2072,7 +2072,7 @@
if (solv->decisionmap[p] > 0)
break;
if (solv->decisionmap[p] == 0)
- queuepush(&dq, p);
+ queue_push(&dq, p);
}
}
if (p)
@@ -2100,7 +2100,7 @@
if (level == 0)
{
printf("UNSOLVABLE\n");
- queuefree(&dq);
+ queue_free(&dq);
return;
}
if (level < systemlevel)
@@ -2116,7 +2116,7 @@
int qcount;
if (pool->verbose) printf("installing recommended packages\n");
- QUEUEEMPTY(&dq);
+ queue_empty(&dq);
for (i = 1; i < pool->nsolvables; i++)
{
if (solv->decisionmap[i] < 0)
@@ -2141,7 +2141,7 @@
break;
}
else if (solv->decisionmap[p] == 0)
- queuepushunique(&dq, p);
+ queue_pushunique(&dq, p);
}
}
}
@@ -2172,7 +2172,7 @@
if (!sup)
continue;
}
- queuepushunique(&dq, i);
+ queue_pushunique(&dq, i);
}
}
if (dq.count)
@@ -2192,7 +2192,7 @@
}
break;
}
- queuefree(&dq);
+ queue_free(&dq);
}
@@ -2214,9 +2214,9 @@
if (sug >= solv->jobrules && sug < solv->systemrules)
sugjob = solv->ruletojob.elements[sug - solv->jobrules];
- queueinit(&disabled);
- QUEUEEMPTY(refined);
- queuepush(refined, sug);
+ queue_init(&disabled);
+ queue_empty(refined);
+ queue_push(refined, sug);
/* re-enable all rules but rule "sug" of the problem */
revert(solv, 1);
@@ -2288,7 +2288,7 @@
r->w1 = solv->pool->whatprovidesdata[r->d];
}
- QUEUEEMPTY(&solv->problems);
+ queue_empty(&solv->problems);
revert(solv, 1); /* XXX move to reset_solver? */
reset_solver(solv);
run_solver(solv, 0, 0);
@@ -2310,8 +2310,8 @@
break;
if (problem[j])
continue;
- queuepush(&disabled, v);
- queuepush(&disabled, 0); /* room for watch */
+ queue_push(&disabled, v);
+ queue_push(&disabled, 0); /* room for watch */
}
if (disabled.count == disabledcnt)
{
@@ -2323,7 +2323,7 @@
if (disabled.count == disabledcnt + 2)
{
/* just one suggestion, add it to refined list */
- queuepush(refined, disabled.elements[disabledcnt]);
+ queue_push(refined, disabled.elements[disabledcnt]);
}
else
{
@@ -2625,17 +2625,17 @@
*
*/
- mapinit(&addedmap, pool->nsolvables);
- mapinit(&noupdaterule, pool->nsolvables);
+ map_init(&addedmap, pool->nsolvables);
+ map_init(&noupdaterule, pool->nsolvables);
- queueinit(&q);
+ queue_init(&q);
/*
* always install our system solvable
*/
MAPSET(&addedmap, SYSTEMSOLVABLE);
- queuepush(&solv->decisionq, SYSTEMSOLVABLE);
- queuepush(&solv->decisionq_why, 0);
+ queue_push(&solv->decisionq, SYSTEMSOLVABLE);
+ queue_push(&solv->decisionq_why, 0);
solv->decisionmap[SYSTEMSOLVABLE] = 1;
/*
@@ -2674,7 +2674,7 @@
break;
case SOLVER_INSTALL_SOLVABLE_NAME:
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- QUEUEEMPTY(&q);
+ queue_empty(&q);
FOR_PROVIDES(p, pp, what)
{
/* if by name, ensure that the name matches */
@@ -2758,36 +2758,36 @@
printf(">!> Installing %s from channel %s\n", id2str(pool, s->name), repo_name(s->repo));
}
addrule(solv, what, 0); /* install by Id */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
break;
case SOLVER_ERASE_SOLVABLE:
addrule(solv, -what, 0); /* remove by Id */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
MAPSET(&noupdaterule, what);
break;
case SOLVER_INSTALL_SOLVABLE_NAME: /* install by capability */
case SOLVER_INSTALL_SOLVABLE_PROVIDES:
- QUEUEEMPTY(&q);
+ queue_empty(&q);
FOR_PROVIDES(p, pp, what)
{
/* if by name, ensure that the name matches */
if (how == SOLVER_INSTALL_SOLVABLE_NAME && pool->solvables[p].name != what)
continue;
- queuepush(&q, p);
+ queue_push(&q, p);
}
if (!q.count)
{
/* no provider, make this an impossible rule */
- queuepush(&q, -SYSTEMSOLVABLE);
+ queue_push(&q, -SYSTEMSOLVABLE);
}
- p = queueshift(&q); /* get first provider */
+ p = queue_shift(&q); /* get first provider */
if (!q.count)
d = 0; /* single provider ? -> make assertion */
else
d = pool_queuetowhatprovides(pool, &q); /* get all providers */
addrule(solv, p, d); /* add 'requires' rule */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
break;
case SOLVER_ERASE_SOLVABLE_NAME: /* remove by capability */
case SOLVER_ERASE_SOLVABLE_PROVIDES:
@@ -2798,13 +2798,13 @@
continue;
addrule(solv, -p, 0); /* add 'remove' rule */
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
MAPSET(&noupdaterule, p);
}
break;
case SOLVER_INSTALL_SOLVABLE_UPDATE: /* find update for solvable */
addupdaterule(solv, pool->solvables + what, &addedmap, 0, 0, 0);
- queuepush(&solv->ruletojob, i);
+ queue_push(&solv->ruletojob, i);
break;
}
}
@@ -2859,9 +2859,9 @@
}
/* free unneeded memory */
- mapfree(&addedmap);
- mapfree(&noupdaterule);
- queuefree(&q);
+ map_free(&addedmap);
+ map_free(&noupdaterule);
+ queue_free(&q);
solv->weakrules = solv->nrules;
@@ -2930,7 +2930,7 @@
if (!enh)
continue;
}
- queuepush(&solv->suggestions, i);
+ queue_push(&solv->suggestions, i);
}
prune_best_version_arch(pool, &solv->suggestions);
}
@@ -2953,8 +2953,8 @@
if (!pool->verbose)
return;
- clonequeue(&problems, &solv->problems);
- queueinit(&solution);
+ queue_clone(&problems, &solv->problems);
+ queue_init(&solution);
printf("Encountered problems! Here are the solutions:\n");
problem = problems.elements;
for (i = 0; i < problems.count; i++)
@@ -3065,8 +3065,8 @@
}
}
printf("------------------------------------\n");
- queuefree(&problems);
- queuefree(&solution);
+ queue_free(&problems);
+ queue_free(&solution);
}
return;
}
Modified: trunk/sat-solver/testsuite/deptestomatic.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/deptestomatic.c?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/testsuite/deptestomatic.c (original)
+++ trunk/sat-solver/testsuite/deptestomatic.c Mon Oct 29 16:00:30 2007
@@ -660,8 +660,8 @@
s->evr = ID_EMPTY;
s->provides = repo_addid_dep(pd->locales, s->provides, id, 0);
- queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
- queuepush( &(pd->trials), s - pool->solvables );
+ queue_push( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
+ queue_push( &(pd->trials), s - pool->solvables );
}
/*----------------------------------------------------------------*/
@@ -926,14 +926,14 @@
if (repo) err( " in channel '%s'", channel );
exit( 1 );
}
- queuepush( &(pd->trials), SOLVER_ERASE_SOLVABLE );
- queuepush( &(pd->trials), id );
+ queue_push( &(pd->trials), SOLVER_ERASE_SOLVABLE );
+ queue_push( &(pd->trials), id );
}
else /* no channel given, lock installed */
{
Id id = select_solvable( pool, pd->system, package, arch );
- queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
- queuepush( &(pd->trials), id );
+ queue_push( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
+ queue_push( &(pd->trials), id );
}
}
break;
@@ -1010,14 +1010,14 @@
if (repo) err( " in channel '%s'", channel );
exit( 1 );
}
- queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
- queuepush( &(pd->trials), id );
+ queue_push( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
+ queue_push( &(pd->trials), id );
}
else /* no channel given, from any channel */
{
Id id = str2id( pool, package, 1 );
- queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES );
- queuepush( &(pd->trials), id );
+ queue_push( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES );
+ queue_push( &(pd->trials), id );
}
}
break;
@@ -1044,8 +1044,8 @@
exit(1);
}
id = str2id( pool, package, 0 );
- queuepush( &(pd->trials), SOLVER_ERASE_SOLVABLE_NAME );
- queuepush( &(pd->trials), id);
+ queue_push( &(pd->trials), SOLVER_ERASE_SOLVABLE_NAME );
+ queue_push( &(pd->trials), id);
}
break;
@@ -1070,8 +1070,8 @@
err( "No name given in <addrequire>" );
exit( 1 );
}
- queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES );
- queuepush( &(pd->trials), str2id( pd->pool, name, 1 ) );
+ queue_push( &(pd->trials), SOLVER_INSTALL_SOLVABLE_PROVIDES );
+ queue_push( &(pd->trials), str2id( pd->pool, name, 1 ) );
}
break;
@@ -1081,8 +1081,8 @@
err( "No name given in <addconflict>" );
exit( 1 );
}
- queuepush( &(pd->trials), SOLVER_ERASE_SOLVABLE_PROVIDES );
- queuepush( &(pd->trials), str2id( pd->pool, name, 1 ) );
+ queue_push( &(pd->trials), SOLVER_ERASE_SOLVABLE_PROVIDES );
+ queue_push( &(pd->trials), str2id( pd->pool, name, 1 ) );
}
break;
@@ -1127,8 +1127,8 @@
exit( 1 );
}
Id id = select_solvable( pool, pd->system, package, arch );
- queuepush( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
- queuepush( &(pd->trials), id );
+ queue_push( &(pd->trials), SOLVER_INSTALL_SOLVABLE );
+ queue_push( &(pd->trials), id );
}
break;
@@ -1193,7 +1193,7 @@
// clean up
solver_free(solv);
- queuefree( &(pd->trials) );
+ queue_free( &(pd->trials) );
}
break;
default:
@@ -1272,7 +1272,7 @@
pd.pool = pool_create();
pd.pool->nscallback = nscallback;
pd.pool->nscallbackdata = &pd;
- queueinit( &pd.trials );
+ queue_init( &pd.trials );
pd.nchannels = 0;
pd.channels = NULL;
Modified: trunk/sat-solver/testsuite/yps.c
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/testsuite/yps.c?rev=7686&r1=7685&r2=7686&view=diff
==============================================================================
--- trunk/sat-solver/testsuite/yps.c (original)
+++ trunk/sat-solver/testsuite/yps.c Mon Oct 29 16:00:30 2007
@@ -35,7 +35,7 @@
Solvable *s;
id = str2id(pool, name, 1);
- queueinit( &plist);
+ queue_init( &plist);
i = repo ? repo->start : 1;
end = repo ? repo->start + repo->nsolvables : pool->nsolvables;
for (; i < end; i++)
@@ -44,7 +44,7 @@
if (!pool_installable(pool, s))
continue;
if (s->name == id)
- queuepush(&plist, i);
+ queue_push(&plist, i);
}
prune_best_version_arch(pool, &plist);
@@ -56,7 +56,7 @@
}
id = plist.elements[0];
- queuefree(&plist);
+ queue_free(&plist);
return pool->solvables + id;
}
@@ -80,7 +80,7 @@
pool = pool_create();
pool_setarch(pool, "i686");
pool->verbose = 1;
- queueinit(&job);
+ queue_init(&job);
if (argc < 3)
{
@@ -134,14 +134,14 @@
else if (!erase)
{
xs = select_solvable(pool, channel, argv[1]);
- queuepush(&job, SOLVER_INSTALL_SOLVABLE);
- queuepush(&job, xs - pool->solvables);
+ queue_push(&job, SOLVER_INSTALL_SOLVABLE);
+ queue_push(&job, xs - pool->solvables);
}
else
{
id = str2id(pool, argv[1], 1);
- queuepush(&job, SOLVER_ERASE_SOLVABLE_NAME);
- queuepush(&job, id);
+ queue_push(&job, SOLVER_ERASE_SOLVABLE_NAME);
+ queue_push(&job, id);
}
pool_prepare(pool);
@@ -164,7 +164,7 @@
// clean up
- queuefree(&job);
+ queue_free(&job);
solver_free(solv);
pool_free(pool);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org