diff options
-rw-r--r-- | lib/depends.c | 16 | ||||
-rw-r--r-- | lib/order.c | 9 | ||||
-rw-r--r-- | lib/rpmts_internal.h | 3 |
3 files changed, 21 insertions, 7 deletions
diff --git a/lib/depends.c b/lib/depends.c index ad9b57777..42c3b8ec0 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -313,6 +313,22 @@ static int findPos(rpmts ts, rpm_color_t tscolor, Header h, int upgrade) return oc; } +rpmal rpmtsCreateAl(rpmts ts, rpmElementTypes types) +{ + rpmal al = NULL; + if (ts) { + rpmte p; + rpmtsi pi; + + al = rpmalCreate((rpmtsNElements(ts) / 4) + 1, rpmtsFlags(ts), + rpmtsColor(ts), rpmtsPrefColor(ts)); + pi = rpmtsiInit(ts); + while ((p = rpmtsiNext(pi, types))) + rpmalAdd(al, p); + rpmtsiFree(pi); + } + return al; +} int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation * relocs) diff --git a/lib/order.c b/lib/order.c index 0c8d1cb9f..c0ef5470a 100644 --- a/lib/order.c +++ b/lib/order.c @@ -548,8 +548,7 @@ int rpmtsOrder(rpmts ts) rpmte * newOrder; int newOrderCount = 0; int rc; - rpmal erasedPackages = rpmalCreate(5, rpmtsFlags(ts), - rpmtsColor(ts), prefcolor); + rpmal erasedPackages; scc SCCs; int nelem = rpmtsNElements(ts); tsortInfo sortInfo = xcalloc(nelem, sizeof(struct tsortInfo_s)); @@ -558,11 +557,7 @@ int rpmtsOrder(rpmts ts) (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_ORDER), 0); /* Create erased package index. */ - pi = rpmtsiInit(ts); - while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) { - rpmalAdd(erasedPackages, p); - } - rpmtsiFree(pi); + erasedPackages = rpmtsCreateAl(ts, TR_REMOVED); for (int i = 0; i < nelem; i++) { sortInfo[i].te = tsmem->order[i]; diff --git a/lib/rpmts_internal.h b/lib/rpmts_internal.h index 60daf47aa..5d3240cf0 100644 --- a/lib/rpmts_internal.h +++ b/lib/rpmts_internal.h @@ -74,6 +74,9 @@ extern "C" { RPM_GNUC_INTERNAL tsMembers rpmtsMembers(rpmts ts); +RPM_GNUC_INTERNAL +rpmal rpmtsCreateAl(rpmts ts, rpmElementTypes types); + /* returns -1 for retry, 0 for ignore and 1 for not found */ RPM_GNUC_INTERNAL int rpmtsSolve(rpmts ts, rpmds key); |