#include "repo.h"
#include "util.h"
-struct _TransactionElement {
+struct s_TransactionElement {
Id p; /* solvable id */
Id edges; /* pointer into edges data */
Id mark;
};
-struct _TransactionOrderdata {
- struct _TransactionElement *tes;
+struct s_TransactionOrderdata {
+ struct s_TransactionElement *tes;
int ntes;
Id *invedgedata;
int ninvedgedata;
void
transaction_clone_orderdata(Transaction *trans, Transaction *srctrans)
{
- struct _TransactionOrderdata *od = srctrans->orderdata;
+ struct s_TransactionOrderdata *od = srctrans->orderdata;
if (!od)
return;
trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata));
{
if (trans->orderdata)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
od->tes = solv_free(od->tes);
od->invedgedata = solv_free(od->invedgedata);
if (od->cycles)
struct orderdata {
Transaction *trans;
- struct _TransactionElement *tes;
+ struct s_TransactionElement *tes;
int ntes;
Id *edgedata;
int nedgedata;
int ncycles;
};
-static int
+static void
addteedge(struct orderdata *od, int from, int to, int type)
{
int i;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
if (from == to)
- return 0;
+ return;
/* printf("edge %d(%s) -> %d(%s) type %x\n", from, pool_solvid2str(pool, od->tes[from].p), to, pool_solvid2str(pool, od->tes[to].p), type); */
for (i = te->edges; od->edgedata[i]; i += 2)
if (od->edgedata[i] == to)
break;
- /* test of brokenness */
- if (type == TYPE_BROKEN)
- return od->edgedata[i] && (od->edgedata[i + 1] & TYPE_BROKEN) != 0 ? 1 : 0;
if (od->edgedata[i])
{
od->edgedata[i + 1] |= type;
- return 0;
+ return;
}
if (i + 1 == od->nedgedata)
{
od->edgedata[i + 1] = type;
od->edgedata[i + 2] = 0; /* end marker */
od->nedgedata = i + 3;
- return 0;
}
-static int
+static void
addedge(struct orderdata *od, Id from, Id to, int type)
{
Transaction *trans = od->trans;
Pool *pool = trans->pool;
Solvable *s;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
int i;
/* printf("addedge %d %d type %d\n", from, to, type); */
from = trans->transaction_installed[from - pool->installed->start];
else
{
- int ret = 0;
Queue ti;
Id tibuf[5];
queue_init_buffer(&ti, tibuf, sizeof(tibuf)/sizeof(*tibuf));
transaction_all_obs_pkgs(trans, from, &ti);
for (i = 0; i < ti.count; i++)
- ret |= addedge(od, ti.elements[i], to, type);
+ addedge(od, ti.elements[i], to, type);
queue_free(&ti);
- return ret;
+ return;
}
}
s = pool->solvables + to;
to = trans->transaction_installed[to - pool->installed->start];
else
{
- int ret = 0;
Queue ti;
Id tibuf[5];
queue_init_buffer(&ti, tibuf, sizeof(tibuf)/sizeof(*tibuf));
transaction_all_obs_pkgs(trans, to, &ti);
for (i = 0; i < ti.count; i++)
- ret |= addedge(od, from, ti.elements[i], type);
+ addedge(od, from, ti.elements[i], type);
queue_free(&ti);
- return ret;
+ return;
}
}
if (te->p == to)
break;
if (i == od->ntes)
- return 0;
+ return;
to = i;
for (i = 1, te = od->tes + i; i < od->ntes; i++, te++)
if (te->p == from)
break;
if (i == od->ntes)
- return 0;
+ return;
+ from = i;
- return addteedge(od, i, to, type);
+ addteedge(od, from, to, type);
}
static inline int
Pool *pool = od->trans->pool;
Id ddegmin, ddegmax, ddeg;
int k, l;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
l = 0;
ddegmin = ddegmax = 0;
POOL_DEBUG(SOLV_DEBUG_STATS, "\n");
}
+#if 0
static inline void
dump_tes(struct orderdata *od)
{
Pool *pool = od->trans->pool;
int i, j;
Queue obsq;
- struct _TransactionElement *te, *te2;
+ struct s_TransactionElement *te, *te2;
queue_init(&obsq);
for (i = 1, te = od->tes + i; i < od->ntes; i++, te++)
}
}
}
+#endif
static void
reachable(struct orderdata *od, Id i)
{
- struct _TransactionElement *te = od->tes + i;
+ struct s_TransactionElement *te = od->tes + i;
int j, k;
if (te->mark != 0)
Transaction *trans = od->trans;
Pool *pool = trans->pool;
#endif
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
int i, j, k, tail;
int head;
Solvable *s;
int i, j, k, numte, numedge;
struct orderdata od;
- struct _TransactionElement *te;
+ struct s_TransactionElement *te;
Queue todo, obsq, samerepoq, uninstq;
int cycstart, cycel;
Id *cycle;
/* free old data if present */
if (trans->orderdata)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
od->tes = solv_free(od->tes);
od->invedgedata = solv_free(od->invedgedata);
trans->orderdata = solv_free(trans->orderdata);
#if 0
printf("do %s [%d]\n", pool_solvid2str(pool, te->p), temedianr[i]);
#endif
- s = pool->solvables + te->p;
for (j = te->edges; od.invedgedata[j]; j++)
{
- struct _TransactionElement *te2 = od.tes + od.invedgedata[j];
+ struct s_TransactionElement *te2 = od.tes + od.invedgedata[j];
assert(te2->mark > 0);
if (--te2->mark == 0)
{
if ((flags & (SOLVER_TRANSACTION_KEEP_ORDERDATA | SOLVER_TRANSACTION_KEEP_ORDERCYCLES)) != 0)
{
- struct _TransactionOrderdata *tod;
+ struct s_TransactionOrderdata *tod;
trans->orderdata = tod = solv_calloc(1, sizeof(*trans->orderdata));
if ((flags & SOLVER_TRANSACTION_KEEP_ORDERCYCLES) != 0)
{
transaction_order_add_choices(Transaction *trans, Id chosen, Queue *choices)
{
int i, j;
- struct _TransactionOrderdata *od = trans->orderdata;
- struct _TransactionElement *te;
+ struct s_TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionElement *te;
if (!od)
return choices->count;
void
transaction_order_get_cycleids(Transaction *trans, Queue *q, int minseverity)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
Queue *cq;
int i, cid, ncycles;
int
transaction_order_get_cycle(Transaction *trans, Id cid, Queue *q)
{
- struct _TransactionOrderdata *od = trans->orderdata;
+ struct s_TransactionOrderdata *od = trans->orderdata;
Queue *cq;
int cmin, cmax, severity;
int ncycles;