tzdata: update bbappend for 2013i
[opendreambox.git] / meta-opendreambox / recipes-devtools / opkg / opkg / 0005-pkg_hash_fetch_conflicts-move-iteration-over-conflic.patch
1 From d0a0f6e1baffc619fba50695baaf5f3ee81db6d6 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 05/19] pkg_hash_fetch_conflicts: move iteration over conflicts
5  to subroutine
6 To: opkg-devel@googlegroups.com
7 Cc: paul@paulbarker.me.uk
8
9 Signed-off-by: Andreas Oberritter <obi@opendreambox.org>
10 ---
11  libopkg/pkg_depends.c | 46 ++++++++++++++++++++++++----------------------
12  1 file changed, 24 insertions(+), 22 deletions(-)
13
14 diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
15 index cd9d2c8..3190b16 100644
16 --- a/libopkg/pkg_depends.c
17 +++ b/libopkg/pkg_depends.c
18 @@ -365,39 +365,22 @@ is_pkg_a_replaces(pkg_t *pkg_scout,pkg_t *pkg)
19  
20  }
21  
22 -
23 -pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
24 +static void __pkg_hash_fetch_conflicts(pkg_t * pkg, pkg_vec_t * installed_conflicts)
25  {
26 -    pkg_vec_t * installed_conflicts, * test_vec;
27 +    pkg_vec_t * test_vec;
28      compound_depend_t * conflicts;
29      depend_t ** possible_satisfiers;
30      depend_t * possible_satisfier;
31      int i, j, k;
32 -    abstract_pkg_t * ab_pkg;
33      pkg_t **pkg_scouts;
34      pkg_t *pkg_scout;
35  
36 -    /*
37 -     * this is a setup to check for redundant/cyclic dependency checks,
38 -     * which are marked at the abstract_pkg level
39 -     */
40 -    if(!(ab_pkg = pkg->parent)){
41 -       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
42 -       return (pkg_vec_t *)NULL;
43 -    }
44 -
45      conflicts = pkg->conflicts;
46 -    if(!conflicts){
47 -       return (pkg_vec_t *)NULL;
48 -    }
49 -    installed_conflicts = pkg_vec_alloc();
50 -
51 -
52 -
53 +    if(!conflicts)
54 +       return;
55  
56      /* foreach conflict */
57      for(i = 0; i < pkg->conflicts_count; i++){
58 -
59         possible_satisfiers = conflicts->possibilities;
60  
61         /* foreach possible satisfier */
62 @@ -433,11 +416,30 @@ pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
63         }
64         conflicts++;
65      }
66 +}
67 +
68 +pkg_vec_t * pkg_hash_fetch_conflicts(pkg_t * pkg)
69 +{
70 +    pkg_vec_t * installed_conflicts;
71 +    abstract_pkg_t * ab_pkg;
72 +
73 +    /*
74 +     * this is a setup to check for redundant/cyclic dependency checks,
75 +     * which are marked at the abstract_pkg level
76 +     */
77 +    if(!(ab_pkg = pkg->parent)){
78 +       opkg_msg(ERROR, "Internal error: %s not in hash table\n", pkg->name);
79 +       return (pkg_vec_t *)NULL;
80 +    }
81 +
82 +    installed_conflicts = pkg_vec_alloc();
83 +
84 +    __pkg_hash_fetch_conflicts(pkg, installed_conflicts);
85  
86      if (installed_conflicts->len)
87             return installed_conflicts;
88      pkg_vec_free(installed_conflicts);
89 -       return (pkg_vec_t *)NULL;
90 +    return (pkg_vec_t *)NULL;
91  }
92  
93  int version_constraints_satisfied(depend_t * depends, pkg_t * pkg)
94 -- 
95 1.9.1
96