1 From b925a520a63fb291675f707e602d04295236c85b Mon Sep 17 00:00:00 2001
2 From: Andreas Oberritter <obi@opendreambox.org>
3 Date: Thu, 17 May 2012 01:17:52 +0200
4 Subject: [PATCH 07/10] pkg_hash_fetch_conflicts: move iteration over
5 conflicts to subroutine
7 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
9 libopkg/pkg_depends.c | 46 ++++++++++++++++++++++++----------------------
10 1 file changed, 24 insertions(+), 22 deletions(-)
12 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
13 index 6ff75f1..1999b64 100644
14 --- a/libopkg/pkg_depends.c
15 +++ b/libopkg/pkg_depends.c
16 @@ -284,39 +284,22 @@ is_pkg_a_replaces(pkg_t *pkg_scout,pkg_t *pkg)
21 -pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
22 +static void __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_vec_t * installed_conflicts)
24 - pkg_vec_t * installed_conflicts, * test_vec;
25 + pkg_vec_t * test_vec;
26 compound_depend_t * conflicts;
27 depend_t ** possible_satisfiers;
28 depend_t * possible_satisfier;
30 - abstract_pkg_t * ab_pkg;
35 - * this is a setup to check for redundant/cyclic dependency checks,
36 - * which are marked at the abstract_pkg level
38 - if(!(ab_pkg = pkg->parent)){
39 - opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
40 - return (pkg_vec_t *)NULL;
43 conflicts = pkg->conflicts;
45 - return (pkg_vec_t *)NULL;
47 - installed_conflicts = pkg_vec_alloc();
54 /* foreach conflict */
55 for(i = 0; i < pkg->conflicts_count; i++){
57 possible_satisfiers = conflicts->possibilities;
59 /* foreach possible satisfier */
60 @@ -352,11 +335,30 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
66 +pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
68 + pkg_vec_t * installed_conflicts;
69 + abstract_pkg_t * ab_pkg;
72 + * this is a setup to check for redundant/cyclic dependency checks,
73 + * which are marked at the abstract_pkg level
75 + if(!(ab_pkg = pkg->parent)){
76 + opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
77 + return (pkg_vec_t *)NULL;
80 + installed_conflicts = pkg_vec_alloc();
82 + __pkg_hash_fetch_conflicts(pkg, installed_conflicts);
84 if (installed_conflicts->len)
85 return installed_conflicts;
86 pkg_vec_free(installed_conflicts);
87 - return (pkg_vec_t *)NULL;
88 + return (pkg_vec_t *)NULL;
91 int version_constraints_satisfied(depend_t * depends, pkg_t * pkg)