diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-12-21 12:12:29 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-12-21 12:12:29 +0200 |
commit | 9b12bc126763b4723be4c7c1e44406b2f00f5759 (patch) | |
tree | df22e1d890e853d131da3f97926ba4d9992d3f2d /lib/order.c | |
parent | 60500572d89f47970d45061c533c4d05ccef3a99 (diff) | |
download | librpm-tizen-9b12bc126763b4723be4c7c1e44406b2f00f5759.tar.gz librpm-tizen-9b12bc126763b4723be4c7c1e44406b2f00f5759.tar.bz2 librpm-tizen-9b12bc126763b4723be4c7c1e44406b2f00f5759.zip |
Eliminate unnecessary depth member from tsortinfo
- its only used for debug log formatting and we can calculate it from
the number of parents in the debug case
Diffstat (limited to 'lib/order.c')
-rw-r--r-- | lib/order.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/order.c b/lib/order.c index d27753248..ae4758eda 100644 --- a/lib/order.c +++ b/lib/order.c @@ -39,7 +39,6 @@ struct relation_s { typedef struct relation_s * relation; struct tsortInfo_s { - int depth; /*!< Depth in dependency tree. */ int tsi_count; // #pkgs this pkg requires int tsi_qcnt; // #pkgs requiring this package int tsi_reqx; // requires Idx/mark as (queued/loop) @@ -211,10 +210,6 @@ static inline int addRelation(rpmts ts, tsi_p->tsi_count++; } - /* Save max. depth in dependency tree */ - if (tsi_p->depth <= tsi_q->depth) - tsi_p->depth = tsi_q->depth + 1; - rel = xcalloc(1, sizeof(*rel)); rel->rel_suc = p; rel->rel_flags = flags; @@ -417,14 +412,16 @@ static void collectTE(rpm_color_t prefcolor, rpmte q, { char deptypechar = (rpmteType(q) == TR_REMOVED ? '-' : '+'); tsortInfo q_tsi = rpmteTSI(q); - int depth = q_tsi->depth; - rpmlog(RPMLOG_DEBUG, "%5d%5d%5d%5d %*s%c%s\n", - *newOrderCount, q_tsi->tsi_count, - q_tsi->tsi_qcnt, - depth, (2 * depth), "", - deptypechar, - (rpmteNEVRA(q) ? rpmteNEVRA(q) : "???")); + if (rpmIsDebug()) { + int depth = 1; + /* figure depth in tree for nice formatting */ + for (rpmte p = q; (p = rpmteParent(p)); depth++) {} + rpmlog(RPMLOG_DEBUG, "%5d%5d%5d%5d %*s%c%s\n", + *newOrderCount, q_tsi->tsi_count, q_tsi->tsi_qcnt, + depth, (2 * depth), "", + deptypechar, (rpmteNEVRA(q) ? rpmteNEVRA(q) : "???")); + } newOrder[*newOrderCount] = q; (*newOrderCount)++; @@ -439,7 +436,6 @@ static void collectTE(rpm_color_t prefcolor, rpmte q, if (p == q) continue; if (p && (--p_tsi->tsi_count) == 0) { - p_tsi->depth = depth + 1; (void) rpmteSetParent(p, q); if (q_tsi->tsi_SccIdx > 1 && q_tsi->tsi_SccIdx != p_tsi->tsi_SccIdx) { @@ -454,7 +450,6 @@ static void collectTE(rpm_color_t prefcolor, rpmte q, p_tsi->tsi_SccIdx != q_tsi->tsi_SccIdx) { if (--SCCs[p_tsi->tsi_SccIdx].count == 0) { /* New SCC is ready, add this package as representative */ - p_tsi->depth = depth + 1; (void) rpmteSetParent(p, q); if (outer_queue != NULL) { @@ -627,14 +622,6 @@ int rpmtsOrder(rpmts ts) } pi = rpmtsiFree(pi); - /* Save predecessor count and mark tree roots. */ - pi = rpmtsiInit(ts); - while ((p = rpmtsiNext(pi, 0)) != NULL) { - tsortInfo p_tsi = rpmteTSI(p); - p_tsi->depth = 1; - } - pi = rpmtsiFree(pi); - newOrder = xcalloc(ts->orderCount, sizeof(*newOrder)); SCCs = detectSCCs(ts); |