summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2009-01-26 13:08:25 +0100
committerMichael Schroeder <mls@suse.de>2009-01-26 13:08:25 +0100
commit94fde0906307a9fe743e3fc4718c86bc545129a7 (patch)
tree88ff464a7ca01f27d6cf05a275626fd8433b4608
parent756bb5ca2010781f4ac336672c844394f374f03f (diff)
downloadlibsolv-94fde0906307a9fe743e3fc4718c86bc545129a7.tar.gz
libsolv-94fde0906307a9fe743e3fc4718c86bc545129a7.tar.bz2
libsolv-94fde0906307a9fe743e3fc4718c86bc545129a7.zip
- add pool_whatprovides_ptr() helper
- use pool_whatprovides_ptr to fix bnc#468313
-rw-r--r--src/pool.c12
-rw-r--r--src/pool.h6
-rw-r--r--src/solvable.c4
-rw-r--r--src/solver.c6
4 files changed, 17 insertions, 11 deletions
diff --git a/src/pool.c b/src/pool.c
index f35ca8f..e1d85b0 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -491,8 +491,8 @@ pool_addrelproviders(Pool *pool, Id d)
{
case REL_AND:
case REL_WITH:
- pp = pool->whatprovidesdata + pool_whatprovides(pool, name);
- pp2 = pool->whatprovidesdata + pool_whatprovides(pool, evr);
+ pp = pool_whatprovides_ptr(pool, name);
+ pp2 = pool_whatprovides_ptr(pool, evr);
while ((p = *pp++) != 0)
{
for (pp3 = pp2; *pp3;)
@@ -504,10 +504,10 @@ pool_addrelproviders(Pool *pool, Id d)
}
break;
case REL_OR:
- pp = pool->whatprovidesdata + pool_whatprovides(pool, name);
+ pp = pool_whatprovides_ptr(pool, name);
while ((p = *pp++) != 0)
queue_push(&plist, p);
- pp = pool->whatprovidesdata + pool_whatprovides(pool, evr);
+ pp = pool_whatprovides_ptr(pool, evr);
while ((p = *pp++) != 0)
queue_pushunique(&plist, p);
break;
@@ -579,7 +579,7 @@ pool_addrelproviders(Pool *pool, Id d)
#endif
if (flags && flags < 8)
{
- pp = pool->whatprovidesdata + pool_whatprovides(pool, name);
+ pp = pool_whatprovides_ptr(pool, name);
while (ISRELDEP(name))
{
rd = GETRELDEP(pool, name);
@@ -1440,7 +1440,7 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res)
conp = s->repo->idarraydata + s->conflicts;
while ((con = *conp++) != 0)
{
- dp = pool->whatprovidesdata + pool_whatprovides(pool, con);
+ dp = pool_whatprovides_ptr(pool, con);
for (; *dp; dp++)
map[p] |= 2; /* XXX: self conflict ? */
}
diff --git a/src/pool.h b/src/pool.h
index 7e38666..c8f2c0d 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -249,6 +249,12 @@ static inline Id pool_whatprovides(Pool *pool, Id d)
return pool_addrelproviders(pool, d);
}
+static inline Id *pool_whatprovides_ptr(Pool *pool, Id d)
+{
+ Id off = pool_whatprovides(pool, d);
+ return pool->whatprovidesdata + off;
+}
+
extern void pool_setdebuglevel(Pool *pool, int level);
static inline void pool_setdebugcallback(Pool *pool, void (*debugcallback)(struct _Pool *, void *data, int type, const char *str), void *debugcallbackdata)
diff --git a/src/solvable.c b/src/solvable.c
index 96e329b..722b82d 100644
--- a/src/solvable.c
+++ b/src/solvable.c
@@ -368,7 +368,7 @@ solvable_trivial_installable_map(Solvable *s, Map *installedmap, Map *conflictsm
conp = s2->repo->idarraydata + s2->conflicts;
while ((con = *conp++) != 0)
{
- dp = pool->whatprovidesdata + pool_whatprovides(pool, con);
+ dp = pool_whatprovides_ptr(pool, con);
for (; *dp; dp++)
if (*dp == p)
return 0;
@@ -462,7 +462,7 @@ pool_create_state_maps(Pool *pool, Queue *installed, Map *installedmap, Map *con
conp = s->repo->idarraydata + s->conflicts;
while ((con = *conp++) != 0)
{
- dp = pool->whatprovidesdata + pool_whatprovides(pool, con);
+ dp = pool_whatprovides_ptr(pool, con);
for (; *dp; dp++)
MAPSET(conflictsmap, *dp);
}
diff --git a/src/solver.c b/src/solver.c
index 33edbe4..bbc598f 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -1301,7 +1301,7 @@ addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m)
continue;
/* find list of solvables providing 'req' */
- dp = pool->whatprovidesdata + pool_whatprovides(pool, req);
+ dp = pool_whatprovides_ptr(pool, req);
if (*dp == SYSTEMSOLVABLE) /* always installed */
continue;
@@ -3880,7 +3880,7 @@ solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep,
{
if (req == SOLVABLE_PREREQMARKER)
continue;
- dp = pool->whatprovidesdata + pool_whatprovides(pool, req);
+ dp = pool_whatprovides_ptr(pool, req);
if (*dp == 0)
break;
}
@@ -4053,7 +4053,7 @@ solver_problemruleinfo(Solver *solv, Queue *job, Id rid, Id *depp, Id *sourcep,
{
if (req == SOLVABLE_PREREQMARKER)
continue;
- dp = pool->whatprovidesdata + pool_whatprovides(pool, req);
+ dp = pool_whatprovides_ptr(pool, req);
if (d == 0)
{
if (*dp == r->w2 && dp[1] == 0)