order.c   order.c 
skipping to change at line 92 skipping to change at line 92
}; };
#endif /* REFERENCE */ #endif /* REFERENCE */
struct badDeps_s { struct badDeps_s {
/*@observer@*/ /*@owned@*/ /*@null@*/ /*@observer@*/ /*@owned@*/ /*@null@*/
const char * pname; const char * pname;
/*@observer@*/ /*@dependent@*/ /*@null@*/ /*@observer@*/ /*@dependent@*/ /*@null@*/
const char * qname; const char * qname;
}; };
#ifdef __cplusplus
GENfree(orderListIndex)
GENfree(rpmte *)
#endif /* __cplusplus */
/*@unchecked@*/ /*@unchecked@*/
static int badDepsInitialized; static int badDepsInitialized;
/*@unchecked@*/ /*@only@*/ /*@null@*/ /*@unchecked@*/ /*@only@*/ /*@null@*/
static struct badDeps_s * badDeps; static struct badDeps_s * badDeps;
/** /**
*/ */
/*@-modobserver -observertrans @*/ /*@-modobserver -observertrans @*/
static void freeBadDeps(void) static void freeBadDeps(void)
skipping to change at line 150 skipping to change at line 155
int msglvl = (anaconda || (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS)) int msglvl = (anaconda || (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS))
? RPMLOG_WARNING : RPMLOG_DEBUG; ? RPMLOG_WARNING : RPMLOG_DEBUG;
#endif #endif
int ac = 0; int ac = 0;
int i; int i;
if (s != NULL && *s != '\0' if (s != NULL && *s != '\0'
&& !(i = poptParseArgvString(s, &ac, (const char ***)&av)) && !(i = poptParseArgvString(s, &ac, (const char ***)&av))
&& ac > 0 && av != NULL) && ac > 0 && av != NULL)
{ {
bdp = badDeps = xcalloc(ac+1, sizeof(*badDeps)); bdp = badDeps = (struct badDeps_s *)xcalloc(ac+1, sizeof(*badDep s));
for (i = 0; i < ac; i++, bdp++) { for (i = 0; i < ac; i++, bdp++) {
char * pname, * qname; char * pname, * qname;
if (av[i] == NULL) if (av[i] == NULL)
break; break;
pname = xstrdup(av[i]); pname = xstrdup(av[i]);
if ((qname = strchr(pname, '>')) != NULL) if ((qname = strchr(pname, '>')) != NULL)
*qname++ = '\0'; *qname++ = '\0';
bdp->pname = pname; bdp->pname = pname;
/*@-usereleased@*/ /*@-usereleased@*/
skipping to change at line 248 skipping to change at line 253
tsi_p->tsi_forward_relations->rel_flags |= flags; tsi_p->tsi_forward_relations->rel_flags |= flags;
return 0; return 0;
} }
/* Record next "q <- p" relation (i.e. "p" requires "q"). */ /* Record next "q <- p" relation (i.e. "p" requires "q"). */
if (p != q) { if (p != q) {
/* bump p predecessor count */ /* bump p predecessor count */
tsi_p->tsi_count++; tsi_p->tsi_count++;
} }
rel = xcalloc(1, sizeof(*rel)); rel = (relation) xcalloc(1, sizeof(*rel));
rel->rel_suc = tsi_p; rel->rel_suc = tsi_p;
rel->rel_flags = flags; rel->rel_flags = flags;
rel->rel_next = tsi_q->tsi_relations; rel->rel_next = tsi_q->tsi_relations;
tsi_q->tsi_relations = rel; tsi_q->tsi_relations = rel;
if (p != q) { if (p != q) {
/* bump q successor count */ /* bump q successor count */
tsi_q->tsi_qcnt++; tsi_q->tsi_qcnt++;
} }
rel = xcalloc(1, sizeof(*rel)); rel = (relation) xcalloc(1, sizeof(*rel));
rel->rel_suc = tsi_q; rel->rel_suc = tsi_q;
rel->rel_flags = flags; rel->rel_flags = flags;
rel->rel_next = tsi_p->tsi_forward_relations; rel->rel_next = tsi_p->tsi_forward_relations;
tsi_p->tsi_forward_relations = rel; tsi_p->tsi_forward_relations = rel;
return 0; return 0;
} }
#endif /* REFERENCE */ #endif /* REFERENCE */
skipping to change at line 586 skipping to change at line 591
/* bump p predecessor count */ /* bump p predecessor count */
rpmteTSI(p)->tsi_count++; rpmteTSI(p)->tsi_count++;
} }
/* Save max. depth in dependency tree */ /* Save max. depth in dependency tree */
if (rpmteDepth(p) <= rpmteDepth(q)) if (rpmteDepth(p) <= rpmteDepth(q))
(void) rpmteSetDepth(p, (rpmteDepth(q) + 1)); (void) rpmteSetDepth(p, (rpmteDepth(q) + 1));
if (rpmteDepth(p) > ts->maxDepth) if (rpmteDepth(p) > ts->maxDepth)
ts->maxDepth = rpmteDepth(p); ts->maxDepth = rpmteDepth(p);
rel = xcalloc(1, sizeof(*rel)); rel = (relation) xcalloc(1, sizeof(*rel));
rel->rel_suc = p; rel->rel_suc = p;
rel->rel_flags = flags; rel->rel_flags = flags;
rel->rel_next = rpmteTSI(q)->tsi_relations; rel->rel_next = rpmteTSI(q)->tsi_relations;
rpmteTSI(q)->tsi_relations = rel; rpmteTSI(q)->tsi_relations = rel;
if (p != q) { if (p != q) {
/* bump q successor count */ /* bump q successor count */
rpmteTSI(q)->tsi_qcnt++; rpmteTSI(q)->tsi_qcnt++;
} }
rel = xcalloc(1, sizeof(*rel)); rel = (relation) xcalloc(1, sizeof(*rel));
rel->rel_suc = q; rel->rel_suc = q;
rel->rel_flags = flags; rel->rel_flags = flags;
rel->rel_next = rpmteTSI(p)->tsi_forward_relations; rel->rel_next = rpmteTSI(p)->tsi_forward_relations;
rpmteTSI(p)->tsi_forward_relations = rel; rpmteTSI(p)->tsi_forward_relations = rel;
return 0; return 0;
} }
/** /**
skipping to change at line 712 skipping to change at line 717
} }
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */ /* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
rpmteTSI(p)->tsi_count++; /* bump p predecessor count */ rpmteTSI(p)->tsi_count++; /* bump p predecessor count */
if (rpmteDepth(p) <= rpmteDepth(q)) /* Save max. depth in depend ency tree */ if (rpmteDepth(p) <= rpmteDepth(q)) /* Save max. depth in depend ency tree */
(void) rpmteSetDepth(p, (rpmteDepth(q) + 1)); (void) rpmteSetDepth(p, (rpmteDepth(q) + 1));
if (rpmteDepth(p) > ts->maxDepth) if (rpmteDepth(p) > ts->maxDepth)
ts->maxDepth = rpmteDepth(p); ts->maxDepth = rpmteDepth(p);
tsi = xcalloc(1, sizeof(*tsi)); tsi = (tsortInfo) xcalloc(1, sizeof(*tsi));
tsi->tsi_suc = p; tsi->tsi_suc = p;
tsi->tsi_tagn = rpmdsTagN(requires); tsi->tsi_tagn = rpmdsTagN(requires);
tsi->tsi_reqx = rpmdsIx(requires); tsi->tsi_reqx = rpmdsIx(requires);
tsi->tsi_next = rpmteTSI(q)->tsi_next; tsi->tsi_next = rpmteTSI(q)->tsi_next;
rpmteTSI(q)->tsi_next = tsi; rpmteTSI(q)->tsi_next = tsi;
rpmteTSI(q)->tsi_qcnt++; /* bump q successor count */ rpmteTSI(q)->tsi_qcnt++; /* bump q successor count */
return 0; return 0;
skipping to change at line 930 skipping to change at line 935
/* Subtract internal relations */ /* Subtract internal relations */
for (rel=tsi_q->tsi_relations; rel != NULL; rel=rel->rel_nex t) { for (rel=tsi_q->tsi_relations; rel != NULL; rel=rel->rel_nex t) {
if (rel->rel_suc != tsi_q if (rel->rel_suc != tsi_q
&& rel->rel_suc->tsi_SccIdx == sd->sccCnt) && rel->rel_suc->tsi_SccIdx == sd->sccCnt)
sd->SCCs[sd->sccCnt].count--; sd->SCCs[sd->sccCnt].count--;
} }
} while (tsi_q != tsi); } while (tsi_q != tsi);
sd->SCCs[sd->sccCnt].size = sd->stackcnt - stackIdx; sd->SCCs[sd->sccCnt].size = sd->stackcnt - stackIdx;
/* copy members */ /* copy members */
sd->SCCs[sd->sccCnt].members = sd->SCCs[sd->sccCnt].members =
xcalloc(sd->SCCs[sd->sccCnt].size, sizeof(tsortInfo) ); (tsortInfo *) xcalloc(sd->SCCs[sd->sccCnt].size, siz eof(tsortInfo));
memcpy(sd->SCCs[sd->sccCnt].members, sd->stack + stackIdx, memcpy(sd->SCCs[sd->sccCnt].members, sd->stack + stackIdx,
sd->SCCs[sd->sccCnt].size * sizeof(tsortInfo)); sd->SCCs[sd->sccCnt].size * sizeof(tsortInfo));
sd->stackcnt = stackIdx; sd->stackcnt = stackIdx;
sd->sccCnt++; sd->sccCnt++;
} }
} }
} }
#else /* REFERENCE */ #else /* REFERENCE */
static void tarjan(sccData sd, rpmte p) static void tarjan(sccData sd, rpmte p)
{ {
skipping to change at line 1003 skipping to change at line 1008
/* Subtract internal relations */ /* Subtract internal relations */
for (rel=tsi_q->tsi_relations; rel != NULL; rel=rel->rel_nex t) { for (rel=tsi_q->tsi_relations; rel != NULL; rel=rel->rel_nex t) {
if (rel->rel_suc != q if (rel->rel_suc != q
&& rpmteTSI(rel->rel_suc)->tsi_SccIdx == sd->sccCnt) && rpmteTSI(rel->rel_suc)->tsi_SccIdx == sd->sccCnt)
sd->SCCs[sd->sccCnt].count--; sd->SCCs[sd->sccCnt].count--;
} }
} while (q != p); } while (q != p);
sd->SCCs[sd->sccCnt].size = sd->stackcnt - stackIdx; sd->SCCs[sd->sccCnt].size = sd->stackcnt - stackIdx;
/* copy members */ /* copy members */
sd->SCCs[sd->sccCnt].members = sd->SCCs[sd->sccCnt].members =
xcalloc(sd->SCCs[sd->sccCnt].size, sizeof(rpmte)); (rpmte *) xcalloc(sd->SCCs[sd->sccCnt].size, sizeof( rpmte));
memcpy(sd->SCCs[sd->sccCnt].members, sd->stack + stackIdx, memcpy(sd->SCCs[sd->sccCnt].members, sd->stack + stackIdx,
sd->SCCs[sd->sccCnt].size * sizeof(rpmte)); sd->SCCs[sd->sccCnt].size * sizeof(rpmte));
sd->stackcnt = stackIdx; sd->stackcnt = stackIdx;
sd->sccCnt++; sd->sccCnt++;
} }
} }
} }
#endif /* REFERENCE */ #endif /* REFERENCE */
/* Search for SCCs and return an array last entry has a .size of 0 */ /* Search for SCCs and return an array last entry has a .size of 0 */
#ifdef REFERENCE #ifdef REFERENCE
static scc detectSCCs(tsortInfo orderInfo, int nelem, int debugloops) static scc detectSCCs(tsortInfo orderInfo, int nelem, int debugloops)
#else /* REFERENCE */ #else /* REFERENCE */
static scc detectSCCs(rpmts ts) static scc detectSCCs(rpmts ts)
#endif /* REFERENCE */ #endif /* REFERENCE */
{ {
int nelem = ts->orderCount; int nelem = ts->orderCount;
scc _SCCs = xcalloc(nelem+3, sizeof(*_SCCs)); scc _SCCs = (scc) xcalloc(nelem+3, sizeof(*_SCCs));
#ifdef REFERENCE #ifdef REFERENCE
tsortInfo *_stack = xcalloc(nelem, sizeof(*_stack)); tsortInfo *_stack = (tsortInfo *) xcalloc(nelem, sizeof(*_stack));
#else #else
rpmte * _stack = xcalloc(nelem , sizeof(*_stack)); rpmte * _stack = (rpmte *) xcalloc(nelem , sizeof(*_stack));
#endif #endif
struct sccData_s sd = { 0, _stack, 0, _SCCs, 2 }; struct sccData_s sd = { 0, _stack, 0, _SCCs, 2 };
#ifdef REFERENCE #ifdef REFERENCE
for (int i = 0; i < nelem; i++) { for (int i = 0; i < nelem; i++) {
tsortInfo tsi = &orderInfo[i]; tsortInfo tsi = &orderInfo[i];
/* Start a DFS at each node */ /* Start a DFS at each node */
if (tsi->tsi_SccIdx == 0) if (tsi->tsi_SccIdx == 0)
tarjan(&sd, tsi); tarjan(&sd, tsi);
} }
skipping to change at line 1052 skipping to change at line 1057
/* Start a DFS at each node */ /* Start a DFS at each node */
if (rpmteTSI(p)->tsi_SccIdx == 0) if (rpmteTSI(p)->tsi_SccIdx == 0)
tarjan(&sd, p); tarjan(&sd, p);
} }
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
} }
#endif /* REFERENCE */ #endif /* REFERENCE */
sd.stack = _free(sd.stack); sd.stack = _free(sd.stack);
sd.SCCs = xrealloc(sd.SCCs, (sd.sccCnt+1)*sizeof(*sd.SCCs)); sd.SCCs = (scc) xrealloc(sd.SCCs, (sd.sccCnt+1)*sizeof(*sd.SCCs));
/* Debug output */ /* Debug output */
if (sd.sccCnt > 2) { if (sd.sccCnt > 2) {
#ifdef REFERENCE #ifdef REFERENCE
int debugloops = (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS); int debugloops = (rpmtsDFlags(ts) & RPMDEPS_FLAG_DEPLOOPS);
int msglvl = debugloops ? RPMLOG_WARNING : RPMLOG_DEBUG; int msglvl = debugloops ? RPMLOG_WARNING : RPMLOG_DEBUG;
#else /* REFERENCE */ #else /* REFERENCE */
int debugloops = (rpmtsDFlags(ts) & (RPMDEPS_FLAG_ANACONDA|RPMDEPS_FLAG_DEP LOOPS)); int debugloops = (rpmtsDFlags(ts) & (RPMDEPS_FLAG_ANACONDA|RPMDEPS_FLAG_DEP LOOPS));
rpmlogLvl msglvl = debugloops ? RPMLOG_WARNING : RPMLOG_ERR; rpmlogLvl msglvl = debugloops ? RPMLOG_WARNING : RPMLOG_ERR;
int i, j; int i, j;
skipping to change at line 1255 skipping to change at line 1260
/* /*
* Run a multi source Dijkstra's algorithm to find relations * Run a multi source Dijkstra's algorithm to find relations
* that can be zapped with least danger to pre reqs. * that can be zapped with least danger to pre reqs.
* As weight of the edges is always 1 it is not necessary to * As weight of the edges is always 1 it is not necessary to
* sort the vertices by distance as the queue gets them * sort the vertices by distance as the queue gets them
* already in order * already in order
*/ */
/* can use a simple queue as edge weights are always 1 */ /* can use a simple queue as edge weights are always 1 */
tsortInfo * queue = xmalloc((SCC.size+1) * sizeof(*queue)); tsortInfo * queue = (tsortInfo *) xmalloc((SCC.size+1) * sizeof(*queue) );
/* /*
* Find packages that are prerequired and use them as * Find packages that are prerequired and use them as
* starting points for the Dijkstra algorithm * starting points for the Dijkstra algorithm
*/ */
start = end = 0; start = end = 0;
for (i = 0; i < SCC.size; i++) { for (i = 0; i < SCC.size; i++) {
tsortInfo tsi = SCC.members[i]; tsortInfo tsi = SCC.members[i];
tsi->tsi_SccLowlink = INT_MAX; tsi->tsi_SccLowlink = INT_MAX;
for (rel=tsi->tsi_forward_relations; rel != NULL; rel=rel->rel_next) { for (rel=tsi->tsi_forward_relations; rel != NULL; rel=rel->rel_next) {
skipping to change at line 1361 skipping to change at line 1366
/* /*
* Run a multi source Dijkstra's algorithm to find relations * Run a multi source Dijkstra's algorithm to find relations
* that can be zapped with least danger to pre reqs. * that can be zapped with least danger to pre reqs.
* As weight of the edges is always 1 it is not necessary to * As weight of the edges is always 1 it is not necessary to
* sort the vertices by distance as the queue gets them * sort the vertices by distance as the queue gets them
* already in order * already in order
*/ */
/* can use a simple queue as edge weights are always 1 */ /* can use a simple queue as edge weights are always 1 */
rpmte * queue = xmalloc((SCC.size+1) * sizeof(rpmte)); rpmte * queue = (rpmte *) xmalloc((SCC.size+1) * sizeof(rpmte));
/* /*
* Find packages that are prerequired and use them as * Find packages that are prerequired and use them as
* starting points for the Dijkstra algorithm * starting points for the Dijkstra algorithm
*/ */
start = end = 0; start = end = 0;
for (i = 0; i < SCC.size; i++) { for (i = 0; i < SCC.size; i++) {
rpmte q = SCC.members[i]; rpmte q = SCC.members[i];
tsortInfo tsi = rpmteTSI(q); tsortInfo tsi = rpmteTSI(q);
tsi->tsi_SccLowlink = INT_MAX; tsi->tsi_SccLowlink = INT_MAX;
skipping to change at line 1461 skipping to change at line 1466
tsMembers tsmem = rpmtsMembers(ts); tsMembers tsmem = rpmtsMembers(ts);
rpm_color_t prefcolor = rpmtsPrefColor(ts); rpm_color_t prefcolor = rpmtsPrefColor(ts);
rpmtsi pi; rpmte p; rpmtsi pi; rpmte p;
tsortInfo q, r; tsortInfo q, r;
rpmte * newOrder; rpmte * newOrder;
int newOrderCount = 0; int newOrderCount = 0;
int rc; int rc;
rpmal erasedPackages = rpmalCreate(5, rpmtsColor(ts), prefcolor); rpmal erasedPackages = rpmalCreate(5, rpmtsColor(ts), prefcolor);
scc SCCs; scc SCCs;
int nelem = rpmtsNElements(ts); int nelem = rpmtsNElements(ts);
tsortInfo sortInfo = xcalloc(nelem, sizeof(struct tsortInfo_s)); tsortInfo sortInfo = (tsortInfo) xcalloc(nelem, sizeof(struct tsortInfo _s));
(void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_ORDER), 0); (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_ORDER), 0);
/* Create erased package index. */ /* Create erased package index. */
pi = rpmtsiInit(ts); pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) { while ((p = rpmtsiNext(pi, TR_REMOVED)) != NULL) {
rpmalAdd(erasedPackages, p); rpmalAdd(erasedPackages, p);
} }
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
skipping to change at line 1492 skipping to change at line 1497
erasedPackages : tsmem->addedPackages; erasedPackages : tsmem->addedPackages;
rpmds requires = rpmdsInit(rpmteDS(p, RPMTAG_REQUIRENAME)); rpmds requires = rpmdsInit(rpmteDS(p, RPMTAG_REQUIRENAME));
while (rpmdsNext(requires) >= 0) { while (rpmdsNext(requires) >= 0) {
/* Record next "q <- p" relation (i.e. "p" requires "q"). */ /* Record next "q <- p" relation (i.e. "p" requires "q"). */
(void) addRelation(ts, al, p, requires); (void) addRelation(ts, al, p, requires);
} }
} }
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
newOrder = xcalloc(tsmem->orderCount, sizeof(*newOrder)); newOrder = (rpmte *) xcalloc(tsmem->orderCount, sizeof(*newOrder));
SCCs = detectSCCs(sortInfo, nelem, (rpmtsFlags(ts) & RPMTRANS_FLAG_DEPL OOPS)); SCCs = detectSCCs(sortInfo, nelem, (rpmtsFlags(ts) & RPMTRANS_FLAG_DEPL OOPS));
rpmlog(RPMLOG_DEBUG, "========== tsorting packages (order, #predecessor s, #succesors, depth)\n"); rpmlog(RPMLOG_DEBUG, "========== tsorting packages (order, #predecessor s, #succesors, depth)\n");
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
/* Do two separate runs: installs first - then erases */ /* Do two separate runs: installs first - then erases */
int oType = !i ? TR_ADDED : TR_REMOVED; int oType = !i ? TR_ADDED : TR_REMOVED;
q = r = NULL; q = r = NULL;
/* Scan for zeroes and add them to the queue */ /* Scan for zeroes and add them to the queue */
for (int e = 0; e < nelem; e++) { for (int e = 0; e < nelem; e++) {
skipping to change at line 1700 skipping to change at line 1705
(void) rpmteSetDepth(p, 1); (void) rpmteSetDepth(p, 1);
if (npreds == 0) if (npreds == 0)
(void) rpmteSetTree(p, treex++); (void) rpmteSetTree(p, treex++);
else else
(void) rpmteSetTree(p, -1); (void) rpmteSetTree(p, -1);
} }
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
ts->ntrees = treex; ts->ntrees = treex;
newOrder = xcalloc(ts->orderCount, sizeof(*newOrder)); newOrder = (rpmte *) xcalloc(ts->orderCount, sizeof(*newOrder));
SCCs = detectSCCs(ts); SCCs = detectSCCs(ts);
rpmlog(RPMLOG_DEBUG, "========== tsorting packages (order, #predecessor s, #succesors, tree, depth)\n"); rpmlog(RPMLOG_DEBUG, "========== tsorting packages (order, #predecessor s, #succesors, tree, depth)\n");
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
/* Do two separate runs: installs first - then erases */ /* Do two separate runs: installs first - then erases */
unsigned oType = (j == 0 ? TR_ADDED : TR_REMOVED); unsigned oType = (j == 0 ? TR_ADDED : TR_REMOVED);
q = r = NULL; q = r = NULL;
pi = rpmtsiInit(ts); pi = rpmtsiInit(ts);
/* Scan for zeroes and add them to the queue */ /* Scan for zeroes and add them to the queue */
skipping to change at line 1799 skipping to change at line 1804
scc SCCs; scc SCCs;
#else /* REFERENCE */ #else /* REFERENCE */
rpmuint32_t tscolor = rpmtsColor(ts); rpmuint32_t tscolor = rpmtsColor(ts);
int anaconda = rpmtsDFlags(ts) & RPMDEPS_FLAG_ANACONDA; int anaconda = rpmtsDFlags(ts) & RPMDEPS_FLAG_ANACONDA;
tsortInfo tsi; tsortInfo tsi;
tsortInfo tsi_next; tsortInfo tsi_next;
alKey * ordering; alKey * ordering;
int orderingCount = 0; int orderingCount = 0;
unsigned char * selected = alloca(sizeof(*selected) * (ts->orderCount + 1)); unsigned char * selected = (unsigned char *) alloca(sizeof(*selected) * (ts->orderCount + 1));
int loopcheck; int loopcheck;
orderListIndex orderList; orderListIndex orderList;
int numOrderList; int numOrderList;
int npeer = 128; /* XXX more than deep enough for now. */ int npeer = 128; /* XXX more than deep enough for now. */
int * peer = memset(alloca(npeer*sizeof(*peer)), 0, (npeer*sizeof(*peer ))); int * peer = (int *) memset(alloca(npeer*sizeof(*peer)), 0, (npeer*size of(*peer)));
int nrescans = 100; int nrescans = 100;
int _printed = 0; int _printed = 0;
char deptypechar; char deptypechar;
size_t tsbytes = 0; size_t tsbytes = 0;
int oType = 0; int oType = 0;
int depth; int depth;
int breadth; int breadth;
int qlen; int qlen;
#endif /* REFERENCE */ #endif /* REFERENCE */
skipping to change at line 1860 skipping to change at line 1865
#else #else
if (oType == 0) if (oType == 0)
numOrderList = ts->orderCount; numOrderList = ts->orderCount;
else { else {
numOrderList = 0; numOrderList = 0;
if (oType & TR_ADDED) if (oType & TR_ADDED)
numOrderList += ts->numAddedPackages; numOrderList += ts->numAddedPackages;
if (oType & TR_REMOVED) if (oType & TR_REMOVED)
numOrderList += ts->numRemovedPackages; numOrderList += ts->numRemovedPackages;
} }
ordering = alloca(sizeof(*ordering) * (numOrderList + 1)); ordering = (alKey *) alloca(sizeof(*ordering) * (numOrderList + 1));
loopcheck = numOrderList; loopcheck = numOrderList;
#endif #endif
pi = rpmtsiInit(ts); pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, oType)) != NULL) while ((p = rpmtsiNext(pi, oType)) != NULL)
rpmteNewTSI(p); rpmteNewTSI(p);
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
/* Record all relations. */ /* Record all relations. */
rpmlog(RPMLOG_DEBUG, D_("========== recording tsort relations\n")); rpmlog(RPMLOG_DEBUG, D_("========== recording tsort relations\n"));
skipping to change at line 1992 skipping to change at line 1997
#ifdef UNNECESSARY #ifdef UNNECESSARY
(void) rpmteSetParent(p, NULL); (void) rpmteSetParent(p, NULL);
#endif #endif
} }
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
ts->ntrees = treex; ts->ntrees = treex;
#ifdef REFERENCE #ifdef REFERENCE
/* Remove dependency loops. */ /* Remove dependency loops. */
newOrder = xcalloc(ts->orderCount, sizeof(*newOrder)); newOrder = (rpmte *) xcalloc(ts->orderCount, sizeof(*newOrder));
SCCs = detectSCCs(ts); SCCs = detectSCCs(ts);
#endif #endif
/* T4. Scan for zeroes. */ /* T4. Scan for zeroes. */
rpmlog(RPMLOG_DEBUG, D_("========== tsorting packages (order, #predeces sors, #succesors, tree, Ldepth, Rbreadth)\n")); rpmlog(RPMLOG_DEBUG, D_("========== tsorting packages (order, #predeces sors, #succesors, tree, Ldepth, Rbreadth)\n"));
#ifdef REFERENCE #ifdef REFERENCE
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
/* Do two separate runs: installs first - then erases */ /* Do two separate runs: installs first - then erases */
unsigned oType = (j == 0 ? TR_ADDED : TR_REMOVED); unsigned oType = (j == 0 ? TR_ADDED : TR_REMOVED);
skipping to change at line 2237 skipping to change at line 2242
/* Clean up tsort remnants (if any). */ /* Clean up tsort remnants (if any). */
pi = rpmtsiInit(ts); pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, 0)) != NULL) while ((p = rpmtsiNext(pi, 0)) != NULL)
rpmteFreeTSI(p); rpmteFreeTSI(p);
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
#ifdef REFERENCE #ifdef REFERENCE
#else /* REFERENCE */ #else /* REFERENCE */
/* The order ends up as installed packages followed by removed packages . */ /* The order ends up as installed packages followed by removed packages . */
orderList = xcalloc(numOrderList, sizeof(*orderList)); orderList = (orderListIndex) xcalloc(numOrderList, sizeof(*orderList));
j = 0; j = 0;
pi = rpmtsiInit(ts); pi = rpmtsiInit(ts);
while ((p = rpmtsiNext(pi, oType)) != NULL) { while ((p = rpmtsiNext(pi, oType)) != NULL) {
/* Prepare added/erased package ordering permutation. */ /* Prepare added/erased package ordering permutation. */
orderList[j].pkgKey = rpmteAddedKey(p); orderList[j].pkgKey = rpmteAddedKey(p);
orderList[j].orIndex = rpmtsiOc(pi); orderList[j].orIndex = rpmtsiOc(pi);
j++; j++;
} }
pi = rpmtsiFree(pi); pi = rpmtsiFree(pi);
qsort(orderList, numOrderList, sizeof(*orderList), orderListIndexCmp); qsort(orderList, numOrderList, sizeof(*orderList), orderListIndexCmp);
/*@-type@*/ /*@-type@*/
newOrder = xcalloc(ts->orderCount, sizeof(*newOrder)); newOrder = (rpmte *) xcalloc(ts->orderCount, sizeof(*newOrder));
/*@=type@*/ /*@=type@*/
for (i = 0, newOrderCount = 0; i < orderingCount; i++) for (i = 0, newOrderCount = 0; i < orderingCount; i++)
{ {
struct orderListIndex_s key; struct orderListIndex_s key;
orderListIndex needle; orderListIndex needle;
key.pkgKey = ordering[i]; key.pkgKey = ordering[i];
needle = bsearch(&key, orderList, numOrderList, needle = bsearch(&key, orderList, numOrderList,
sizeof(key), orderListIndexCmp); sizeof(key), orderListIndexCmp);
if (needle == NULL) /* XXX can't happen */ if (needle == NULL) /* XXX can't happen */
 End of changes. 24 change blocks. 
23 lines changed or deleted 28 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/