return r;
}
+static void transaction_unlink_job(Manager *m, Job *j, bool delete_dependencies);
+
static void transaction_delete_job(Manager *m, Job *j, bool delete_dependencies) {
assert(m);
assert(j);
/* Deletes one job from the transaction */
- manager_transaction_unlink_job(m, j, delete_dependencies);
+ transaction_unlink_job(m, j, delete_dependencies);
if (!j->installed)
job_free(j);
while ((j = hashmap_first(m->transaction_jobs)))
if (j->installed)
transaction_delete_job(m, j, true);
- else
+ else {
+ transaction_unlink_job(m, j, true);
job_free(j);
+ }
assert(hashmap_isempty(m->transaction_jobs));
assert(j->unit == other->unit);
assert(!j->installed);
- /* Merges 'other' into 'j' and then deletes j. */
+ /* Merges 'other' into 'j' and then deletes 'other'. */
j->type = t;
j->state = JOB_WAITING;
other->object_list = NULL;
transaction_delete_job(m, other, true);
}
+
static bool job_is_conflicted_by(Job *j) {
JobDependency *l;
LIST_PREPEND(Job, transaction, f, j);
if (hashmap_replace(m->transaction_jobs, unit, f) < 0) {
+ LIST_REMOVE(Job, transaction, f, j);
job_free(j);
return NULL;
}
return j;
}
-void manager_transaction_unlink_job(Manager *m, Job *j, bool delete_dependencies) {
+static void transaction_unlink_job(Manager *m, Job *j, bool delete_dependencies) {
assert(m);
assert(j);