libopkg: directly pass type to parseDepends()
authorJo-Philipp Wich <jo@mein.io>
Wed, 15 Feb 2017 23:09:05 +0000 (00:09 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 16 Feb 2017 16:02:30 +0000 (17:02 +0100)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/pkg_depends.c

index a12b313127fb84dc801cfd8098cf3c5d40505373..06519e1b3f3827308df8f30950aa4f1a1668c469 100644 (file)
@@ -26,7 +26,7 @@
 #include "hash_table.h"
 #include "libbb/libbb.h"
 
-static int parseDepends(compound_depend_t * compound_depend, char *depend_str);
+static int parseDepends(compound_depend_t * compound_depend, char *depend_str, enum depend_type type);
 static depend_t *depend_init(void);
 static char **add_unresolved_dep(pkg_t * pkg, char **the_lost, int ref_ndx);
 static char **merge_unresolved(char **oldstuff, char **newstuff);
@@ -868,9 +868,7 @@ void parse_deplist(pkg_t *pkg, enum depend_type type, char *list)
                deps = tmp;
 
                memset(deps + count - 1, 0, sizeof(compound_depend_t));
-               parseDepends(deps + count - 1, item);
-
-               deps[count - 1].type = type;
+               parseDepends(deps + count - 1, item, type);
        }
 
        if (!deps)
@@ -1064,13 +1062,13 @@ static depend_t *depend_init(void)
        return d;
 }
 
-static int parseDepends(compound_depend_t * compound_depend, char *depend_str)
+static int parseDepends(compound_depend_t * compound_depend, char *depend_str, enum depend_type type)
 {
        int i;
        char *depend, *name, *vstr, *rest, *tok = NULL;
        depend_t **possibilities = NULL, **tmp;
 
-       compound_depend->type = DEPEND;
+       compound_depend->type = type;
 
        for (i = 0, depend = strtok_r(depend_str, "|", &tok); depend; i++, depend = strtok_r(NULL, "|", &tok)) {
                name = strtok(depend, " ");