Commit 43be8983 authored by Bernhard Link's avatar Bernhard Link

[refactor] move free'ing of ofk out of target.c's addpackages

parent 595922bb
......@@ -125,7 +125,7 @@ retvalue references_add(const char *identifier, const struct strlist *files) {
/* Remove reference by <identifier> for the given <oldfiles>,
* excluding <exclude>, if it is nonNULL. */
retvalue references_delete(const char *identifier, struct strlist *files, const struct strlist *exclude) {
retvalue references_delete(const char *identifier, const struct strlist *files, const struct strlist *exclude) {
retvalue result, r;
int i;
......
......@@ -30,7 +30,7 @@ retvalue references_add(const char *, const struct strlist *);
/* Remove reference by <identifier> for the given <oldfiles>,
* excluding <exclude>, if it is nonNULL. */
retvalue references_delete(const char *, struct strlist *, /*@null@*/const struct strlist * /*exclude*/);
retvalue references_delete(const char *, const struct strlist *, /*@null@*/const struct strlist * /*exclude*/);
/* add an reference to a file for an identifier. */
retvalue references_increment(const char * /*needed*/, const char * /*needey*/);
......
......@@ -340,7 +340,7 @@ retvalue package_remove_by_cursor(struct package_cursor *tc, struct logger *logg
return result;
}
static retvalue addpackages(struct target *target, const char *packagename, const char *controlchunk, const char *version, const struct strlist *files, /*@null@*/const struct package *old, /*@only@*//*@null@*/struct strlist *oldfiles, /*@null@*/struct logger *logger, /*@null@*/struct trackingdata *trackingdata, architecture_t architecture, /*@null@*/const char *causingrule, /*@null@*/const char *suitefrom) {
static retvalue addpackages(struct target *target, const char *packagename, const char *controlchunk, const char *version, const struct strlist *files, /*@null@*/const struct package *old, /*@null@*/const struct strlist *oldfiles, /*@null@*/struct logger *logger, /*@null@*/struct trackingdata *trackingdata, architecture_t architecture, /*@null@*/const char *causingrule, /*@null@*/const char *suitefrom) {
retvalue result, r;
struct table *table = target->packages;
......@@ -359,11 +359,8 @@ static retvalue addpackages(struct target *target, const char *packagename, cons
r = references_insert(target->identifier, files, oldfiles);
if (RET_WAS_ERROR(r)) {
if (oldfiles != NULL)
strlist_done(oldfiles);
if (RET_WAS_ERROR(r))
return r;
}
/* Add package to the distribution's database */
......@@ -374,11 +371,8 @@ static retvalue addpackages(struct target *target, const char *packagename, cons
result = table_adduniqrecord(table, packagename, controlchunk);
}
if (RET_WAS_ERROR(result)) {
if (oldfiles != NULL)
strlist_done(oldfiles);
if (RET_WAS_ERROR(result))
return result;
}
if (logger != NULL) {
logger_log(logger, target, packagename,
......@@ -406,7 +400,6 @@ static retvalue addpackages(struct target *target, const char *packagename, cons
if (oldfiles != NULL) {
r = references_delete(target->identifier, oldfiles, files);
RET_UPDATE(result, r);
strlist_done(oldfiles);
}
return result;
......@@ -512,6 +505,8 @@ retvalue target_addpackage(struct target *target, struct logger *logger, const c
logger,
trackingdata, architecture,
causingrule, suitefrom);
if (ofk != NULL)
strlist_done(ofk);
if (RET_IS_OK(r)) {
target->wasmodified = true;
if (trackingdata == NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment