From fe14aa01d5d69f526ac82b4c9df48fb1ca91fe3e Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 19 Nov 2010 14:25:33 -0300 Subject: [PATCH] qpkg/prereq.c (resolve): simplify requisites chaining logic Tried to keep next_dep at the beginning, but that's actually unnecessary. The historical background is that the dependency list pointer was originally thought to point to the list currently being processes. But since it's a list following it, we don't need to maintain the original order. --- qpkg/prereq.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/qpkg/prereq.c b/qpkg/prereq.c index 841aedf..c503d9d 100644 --- a/qpkg/prereq.c +++ b/qpkg/prereq.c @@ -183,18 +183,11 @@ static void resolve(struct list *next_dep, const struct ref *dep, continue; push(pkg); more_deps.refs = pkg->depends; - if (next_dep) { - more_deps.next = next_dep->next; - next_dep->next = &more_deps; - } else { - more_deps.next = NULL; - } + more_deps.next = next_dep; more_conf.refs = pkg->conflicts; more_conf.next = conf; - resolve(next_dep ? next_dep : &more_deps, dep->next, - &more_conf); - if (next_dep) - next_dep->next = more_deps.next; + resolve(&more_deps, dep->next, &more_conf); + next_dep = more_deps.next; pop(); } }