typedef struct scc_s * scc;
struct relation_s {
- rpmte rel_suc; // pkg requiring this package
+ tsortInfo rel_suc; // pkg requiring this package
rpmsenseFlags rel_flags; // accumulated flags of the requirements
struct relation_s * rel_next;
};
tsi_q = rpmteTSI(q);
/* if relation got already added just update the flags */
- if (tsi_q->tsi_relations && tsi_q->tsi_relations->rel_suc == p) {
+ if (tsi_q->tsi_relations && tsi_q->tsi_relations->rel_suc == tsi_p) {
tsi_q->tsi_relations->rel_flags |= flags;
tsi_p->tsi_forward_relations->rel_flags |= flags;
return 0;
}
rel = xcalloc(1, sizeof(*rel));
- rel->rel_suc = p;
+ rel->rel_suc = tsi_p;
rel->rel_flags = flags;
rel->rel_next = tsi_q->tsi_relations;
}
rel = xcalloc(1, sizeof(*rel));
- rel->rel_suc = q;
+ rel->rel_suc = tsi_q;
rel->rel_flags = flags;
rel->rel_next = tsi_p->tsi_forward_relations;
stack[stackcnt++] = p; /* Push p on the stack */
for (rel=tsi->tsi_relations; rel != NULL; rel=rel->rel_next) {
/* Consider successors of p */
- q = rel->rel_suc;
- tsi_q = rpmteTSI(q);
+ tsi_q = rel->rel_suc;
if (tsi_q->tsi_SccIdx > 0)
/* Ignore already found SCCs */
continue;
if (tsi_q->tsi_SccIdx == 0){
/* Was successor q not yet visited? */
- tarjan(q); /* Recurse */
+ tarjan(tsi_q->te); /* Recurse */
/* negative index numers: use max as it is closer to 0 */
tsi->tsi_SccLowlink = (
tsi->tsi_SccLowlink > tsi_q->tsi_SccLowlink
/* Subtract internal relations */
for (rel=tsi_q->tsi_relations; rel != NULL;
rel=rel->rel_next) {
- if (rel->rel_suc != q &&
- rpmteTSI(rel->rel_suc)->tsi_SccIdx == sccCnt)
+ if (rel->rel_suc != tsi_q &&
+ rel->rel_suc->tsi_SccIdx == sccCnt)
SCCs[sccCnt].count--;
}
} while (q != p);
rpmte member = SCCs[i].members[j];
relation rel = rpmteTSI(member)->tsi_forward_relations;
for (; rel != NULL; rel=rel->rel_next) {
- if (rpmteTSI(rel->rel_suc)->tsi_SccIdx!=i) continue;
+ if (rel->rel_suc->tsi_SccIdx!=i) continue;
rpmlog(msglvl, "\t\t%s %s\n",
rel->rel_flags ? "=>" : "->",
- rpmteNEVRA(rel->rel_suc));
+ rpmteNEVRA(rel->rel_suc->te));
}
}
}
/* T6. Erase relations. */
for (relation rel = q_tsi->tsi_relations;
rel != NULL; rel = rel->rel_next) {
- rpmte p = rel->rel_suc;
- tsortInfo p_tsi = rpmteTSI(p);
+ tsortInfo p_tsi = rel->rel_suc;
+ rpmte p = p_tsi->te;
/* ignore already collected packages */
if (p_tsi->tsi_SccIdx == 0) continue;
if (p == q) continue;
tsortInfo tsi = rpmteTSI(q);
tsi->tsi_SccLowlink = INT_MAX;
for (rel=tsi->tsi_forward_relations; rel != NULL; rel=rel->rel_next) {
- if (rel->rel_flags && rpmteTSI(rel->rel_suc)->tsi_SccIdx == sccNr) {
- if (rel->rel_suc != q) {
+ if (rel->rel_flags && rel->rel_suc->tsi_SccIdx == sccNr) {
+ if (rel->rel_suc->te != q) {
tsi->tsi_SccLowlink = 0;
queue[end++] = q;
} else {
rpmte q = queue[start++];
tsortInfo tsi = rpmteTSI(q);
for (rel=tsi->tsi_forward_relations; rel != NULL; rel=rel->rel_next) {
- tsortInfo next_tsi = rpmteTSI(rel->rel_suc);
+ tsortInfo next_tsi = rel->rel_suc;
if (next_tsi->tsi_SccIdx != sccNr) continue;
if (next_tsi->tsi_SccLowlink > tsi->tsi_SccLowlink+1) {
next_tsi->tsi_SccLowlink = tsi->tsi_SccLowlink + 1;
- queue[end++] = rel->rel_suc;
+ queue[end++] = rel->rel_suc->te;
}
}
}