free(m);
}
+static void transaction_delete_job(Manager *m, Job *j) {
+ assert(m);
+ assert(j);
+
+ manager_transaction_unlink_job(m, j);
+
+ if (!j->linked)
+ job_free(j);
+}
+
static void transaction_abort(Manager *m) {
Job *j;
while ((j = hashmap_first(m->transaction_jobs)))
if (j->linked)
- manager_transaction_delete_job(m, j);
+ transaction_delete_job(m, j);
else
job_free(j);
/* Kill the other job */
other->subject_list = NULL;
other->object_list = NULL;
- manager_transaction_delete_job(m, other);
+ transaction_delete_job(m, other);
}
static int transaction_merge_jobs(Manager *m) {
for (k = from; k; k = (k->generation == generation ? k->marker : NULL)) {
if (!k->matters_to_anchor) {
log_debug("Breaking order cycle by deleting job %s", name_id(k->name));
- manager_transaction_delete_job(m, k);
+ transaction_delete_job(m, k);
return -EAGAIN;
}
if (j->object_list)
continue;
- manager_transaction_delete_job(m, j);
+ transaction_delete_job(m, j);
again = true;
break;
}
return j;
}
-void manager_transaction_delete_job(Manager *m, Job *j) {
+void manager_transaction_unlink_job(Manager *m, Job *j) {
assert(m);
assert(j);
job_dependency_free(j->object_list);
if (other) {
- log_debug("Deleting job %s, as dependency of job %s", name_id(j->name), name_id(other->name));
- manager_transaction_delete_job(m, other);
+ log_debug("Deleting job %s dependency of job %s", name_id(other->name), name_id(j->name));
+ transaction_delete_job(m, other);
}
}
}
void manager_dump_names(Manager *s, FILE *f, const char *prefix);
void manager_dump_jobs(Manager *s, FILE *f, const char *prefix);
-void manager_transaction_delete_job(Manager *m, Job *j);
+void manager_transaction_unlink_job(Manager *m, Job *j);
void manager_clear_jobs(Manager *m);