summaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-19 04:15:20 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-19 04:15:20 +0100
commit11dd41ce4b465f6260ce68aa050a488f88f694eb (patch)
tree32cf857bcd71798adc6184dd24fe358ae0048188 /job.c
parent42f4e3c4413ad35e3815f25211fee95d775488a7 (diff)
first try at implementing job creation
Diffstat (limited to 'job.c')
-rw-r--r--job.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/job.c b/job.c
index 2cf8be5330..2f7912d262 100644
--- a/job.c
+++ b/job.c
@@ -25,31 +25,14 @@ Job* job_new(Manager *m, JobType type, Name *name) {
return j;
}
-int job_link(Job *j) {
- int r;
-
- assert(j);
- assert(!j->linked);
-
- if ((r = hashmap_put(j->manager->jobs, UINT32_TO_PTR(j->id), j)) < 0)
- return r;
-
- j->name->meta.job = j;
-
- j->linked = true;
-
- return 0;
-}
-
void job_free(Job *j) {
assert(j);
/* Detach from next 'bigger' objects */
if (j->linked) {
- assert(j->name);
- assert(j->name->meta.job == j);
- j->name->meta.job = NULL;
+ if (j->name->meta.job == j)
+ j->name->meta.job = NULL;
hashmap_remove(j->manager->jobs, UINT32_TO_PTR(j->id));
}
@@ -82,7 +65,7 @@ void job_dump(Job *j, FILE*f) {
assert(j);
assert(f);
- fprintf(f, "Job %u (%s) →%s in state %s\n",
+ fprintf(f, "Job %u (%s) → %s in state %s\n",
j->id,
name_id(j->name),
job_type_table[j->type],