diff options
author | Timo Teräs <timo.teras@iki.fi> | 2011-08-05 11:53:26 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2011-08-05 14:34:58 +0300 |
commit | 48d368e7d53ebdfd7ec0abcdd8340ae339de6030 (patch) | |
tree | 6f610183ec408ffa6dcd63abbbba0276341dbd18 /src/dot.c | |
parent | a5146f1b6cb5bb0cf56c6aa8293e26302e5d0ee2 (diff) | |
download | apk-tools-48d368e7d53ebdfd7ec0abcdd8340ae339de6030.tar.gz apk-tools-48d368e7d53ebdfd7ec0abcdd8340ae339de6030.tar.bz2 apk-tools-48d368e7d53ebdfd7ec0abcdd8340ae339de6030.tar.xz apk-tools-48d368e7d53ebdfd7ec0abcdd8340ae339de6030.zip |
solver: move topology sorting to solver code
this allows quite some optimizations to running time and memory
requirements.
Diffstat (limited to 'src/dot.c')
-rw-r--r-- | src/dot.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -53,16 +53,15 @@ static int dump_pkg(struct dot_ctx *ctx, struct apk_package *pkg) { int i, j, r, ret = 0; - /* Succesfully vandalize the apk_package by reusing - * size field for our evil purposes ;) */ - if (pkg->size == S_EVALUATED) + if (pkg->state_int == S_EVALUATED) return 0; - if (((ssize_t)pkg->size) <= S_EVALUATING) { - pkg->size--; + + if (pkg->state_int <= S_EVALUATING) { + pkg->state_int--; return 1; } - pkg->size = S_EVALUATING; + pkg->state_int = S_EVALUATING; for (i = 0; i < pkg->depends->num; i++) { struct apk_dependency *dep = &pkg->depends->item[i]; struct apk_name *name = dep->name; @@ -96,8 +95,8 @@ static int dump_pkg(struct dot_ctx *ctx, struct apk_package *pkg) } } } - ret -= S_EVALUATING - pkg->size; - pkg->size = S_EVALUATED; + ret -= S_EVALUATING - pkg->state_int; + pkg->state_int = S_EVALUATED; return ret; } |