libopkg: fix replacelist parsing and writing
[project/opkg-lede.git] / libopkg / pkg_depends.c
index 748b5999393e6627ac5df5b3dcbf5aa2456618d9..ae2ac9baaebb962d9bf93ef8fa6a8c268062de73 100644 (file)
@@ -668,9 +668,8 @@ void parse_replacelist(pkg_t *pkg, char *list)
 
        abstract_pkg_vec_insert(ab_pkg->provided_by, ab_pkg);
 
-       for (count = 1, item = strtok_r(list, ", ", &tok);
-            item;
-            count++, item = strtok_r(NULL, ", ", &tok), count++) {
+       for (count = 1, item = strtok_r(list, ", ", &tok); item;
+            count++, item = strtok_r(NULL, ", ", &tok)) {
                tmp = realloc(replaces, sizeof(abstract_pkg_t *) * (count + 1));
 
                if (!tmp)