diff options
author | Florian Festi <ffesti@redhat.com> | 2009-04-14 10:54:58 +0200 |
---|---|---|
committer | Florian Festi <ffesti@redhat.com> | 2009-06-04 15:15:16 +0200 |
commit | 50fe90eeb59d7b3dc0495bc719c5a84cddd8cbb3 (patch) | |
tree | 332fc68ebf6087ad401665e00eafb769d4238534 /lib/rpmte.c | |
parent | aefe94178709cd4c42fc87e2421106421d7f9bd4 (diff) | |
download | rpm-50fe90eeb59d7b3dc0495bc719c5a84cddd8cbb3.tar.gz rpm-50fe90eeb59d7b3dc0495bc719c5a84cddd8cbb3.tar.bz2 rpm-50fe90eeb59d7b3dc0495bc719c5a84cddd8cbb3.zip |
Rewrite ordering
- Detect strongly connected components (SCCs) using Tarjan's SCC algorithm
- Use Dijkstra's algorithm to find the best relations to zap
- Add forward relations for the Dijkstra's algorithm
- Separate the per package ordering data and the relations
Diffstat (limited to 'lib/rpmte.c')
-rw-r--r-- | lib/rpmte.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/rpmte.c b/lib/rpmte.c index e1ef0604a..c7ee82a33 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -524,19 +524,21 @@ tsortInfo rpmteTSI(rpmte te) void rpmteFreeTSI(rpmte te) { - if (te != NULL && rpmteTSI(te) != NULL) { - tsortInfo tsi; - - /* Clean up tsort remnants (if any). */ - while ((tsi = rpmteTSI(te)->tsi_next) != NULL) { - rpmteTSI(te)->tsi_next = tsi->tsi_next; - tsi->tsi_next = NULL; - tsi = _free(tsi); - } - te->tsi = _free(te->tsi); + relation rel; + if (te == NULL || rpmteTSI(te) == NULL) return; + + while (te->tsi->tsi_relations != NULL) { + rel = te->tsi->tsi_relations; + te->tsi->tsi_relations = te->tsi->tsi_relations->rel_next; + rel = _free(rel); } - /* FIX: te->tsi is NULL */ - return; + while (te->tsi->tsi_forward_relations != NULL) { + rel = te->tsi->tsi_forward_relations; + te->tsi->tsi_forward_relations = \ + te->tsi->tsi_forward_relations->rel_next; + rel = _free(rel); + } + te->tsi = _free(te->tsi); } void rpmteNewTSI(rpmte te) @@ -544,6 +546,7 @@ void rpmteNewTSI(rpmte te) if (te != NULL) { rpmteFreeTSI(te); te->tsi = xcalloc(1, sizeof(*te->tsi)); + memset(te->tsi, 0, sizeof(*te->tsi)); } } |