chiark / gitweb /
job: job_new() can find the manager from the unit
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 17 Apr 2012 23:39:20 +0000 (01:39 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Fri, 20 Apr 2012 15:12:27 +0000 (17:12 +0200)
src/core/job.c
src/core/job.h
src/core/transaction.c

index 543f37d0dbff98d0f0bc0beaf72ec3bd24393d84..bfb6b7443a8673a52b25b9c4006ffdc6536548a9 100644 (file)
 #include "log.h"
 #include "dbus-job.h"
 
-Job* job_new(Manager *m, JobType type, Unit *unit) {
+Job* job_new(Unit *unit, JobType type) {
         Job *j;
 
-        assert(m);
         assert(type < _JOB_TYPE_MAX);
         assert(unit);
 
         if (!(j = new0(Job, 1)))
                 return NULL;
 
-        j->manager = m;
-        j->id = m->current_job_id++;
+        j->manager = unit->manager;
+        j->id = j->manager->current_job_id++;
         j->type = type;
         j->unit = unit;
 
index e25fc26235b35ee19e97e89ff6d94dc1e7abc9e8..35c213d7400a3acf64493b44d093bf18b1a9bc47 100644 (file)
@@ -137,7 +137,7 @@ struct Job {
         bool ignore_order:1;
 };
 
-Job* job_new(Manager *m, JobType type, Unit *unit);
+Job* job_new(Unit *unit, JobType type);
 void job_uninstall(Job *j);
 void job_free(Job *job);
 void job_dump(Job *j, FILE*f, const char *prefix);
index 8fa89a7be3981d7831ed638ec3647a5000a308eb..1344e2fb9627c66e24d8212d587952293b4d164c 100644 (file)
@@ -763,7 +763,7 @@ static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, b
         if (unit->job && unit->job->type == type)
                 j = unit->job;
         else {
-                j = job_new(unit->manager, type, unit);
+                j = job_new(unit, type);
                 if (!j)
                         return NULL;
         }