From: Panu Matilainen Date: Fri, 5 Oct 2012 07:16:44 +0000 (+0300) Subject: Avoid changing the dependency sets when looking up from rpmal X-Git-Tag: tznext/4.11.0.1.tizen20130304~178 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7612b1684a894a719aa273d1fe091aaa6322e0b9;p=tools%2Flibrpm-tizen.git Avoid changing the dependency sets when looking up from rpmal - Use indexed access and comparison to avoid mucking around with eg transaction element dependency sets while the callers are walking over them. --- diff --git a/lib/rpmal.c b/lib/rpmal.c index 63a70e2..d3bac97 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -357,7 +357,7 @@ static rpmte * rpmalAllFileSatisfiesDepend(const rpmal al, const char *fileName) rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds) { rpmte * ret = NULL; - int i, found; + int i, ix, found; rpmsid nameId; const char *name; availableIndexEntry result; @@ -397,15 +397,13 @@ rpmte * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds) alp = al->list + result[i].pkgNum; if (alp->p == NULL) // deleted continue; - (void) rpmdsSetIx(alp->provides, result[i].entryIx); + ix = result[i].entryIx; /* Obsoletes are on package name, filter out other provide matches */ - if (obsolete && !rstreq(rpmdsN(alp->provides), rpmteN(alp->p))) + if (obsolete && !rstreq(rpmdsNIndex(alp->provides, ix), rpmteN(alp->p))) continue; - rc = 0; - if (rpmdsIx(alp->provides) >= 0) - rc = rpmdsCompare(alp->provides, ds); + rc = rpmdsCompareIndex(alp->provides, ix, ds, rpmdsIx(ds)); if (rc) { rpmdsNotify(ds, "(added provide)", 0);