5808c92173e9b1a55516d9bbd5a7fa1b483f28ed
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-devtools / opkg / opkg / 0007-pkg_hash_fetch_conflicts-move-iteration-over-conflic.patch
1 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
2 index 512d17f..ca3acbe 100644
3 --- a/libopkg/pkg_depends.c
4 +++ b/libopkg/pkg_depends.c
5 @@ -369,40 +369,22 @@ is_pkg_a_replaces(pkg_t *pkg_scout,pkg_t *pkg)
6  }
7  
8  
9 -pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
10 +static void __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_vec_t * installed_conflicts)
11  {
12 -    pkg_vec_t * installed_conflicts, * test_vec;
13 +    pkg_vec_t * test_vec;
14      compound_depend_t * conflicts;
15      depend_t ** possible_satisfiers;
16      depend_t * possible_satisfier;
17      int i, j, k;
18 -    int count;
19 -    abstract_pkg_t * ab_pkg;
20      pkg_t **pkg_scouts;
21      pkg_t *pkg_scout;
22  
23 -    /*
24 -     * this is a setup to check for redundant/cyclic dependency checks,
25 -     * which are marked at the abstract_pkg level
26 -     */
27 -    if(!(ab_pkg = pkg->parent)){
28 -       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
29 -       return (pkg_vec_t *)NULL;
30 -    }
31 -
32      conflicts = pkg->conflicts;
33 -    if(!conflicts){
34 -       return (pkg_vec_t *)NULL;
35 -    }
36 -    installed_conflicts = pkg_vec_alloc();
37 -
38 -    count = pkg->conflicts_count;
39 -
40 -
41 +    if(!conflicts)
42 +        return;
43  
44      /* foreach conflict */
45      for(i = 0; i < pkg->conflicts_count; i++){
46 -
47         possible_satisfiers = conflicts->possibilities;
48  
49         /* foreach possible satisfier */
50 @@ -438,11 +420,30 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
51         }
52         conflicts++;
53      }
54 +}
55 +
56 +pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
57 +{
58 +    pkg_vec_t * installed_conflicts;
59 +    abstract_pkg_t * ab_pkg;
60 +
61 +    /*
62 +     * this is a setup to check for redundant/cyclic dependency checks,
63 +     * which are marked at the abstract_pkg level
64 +     */
65 +    if(!(ab_pkg = pkg->parent)){
66 +       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
67 +       return (pkg_vec_t *)NULL;
68 +    }
69 +
70 +    installed_conflicts = pkg_vec_alloc();
71 +
72 +    __pkg_hash_fetch_conflicts(pkg, installed_conflicts);
73  
74      if (installed_conflicts->len)
75             return installed_conflicts;
76      pkg_vec_free(installed_conflicts);
77 -       return (pkg_vec_t *)NULL;
78 +    return (pkg_vec_t *)NULL;
79  }
80  
81  int version_constraints_satisfied(depend_t * depends, pkg_t * pkg)