summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-11-15 19:19:57 +0100
committerLennart Poettering <lennart@poettering.net>2016-11-16 15:03:26 +0100
commit0a23a627296841a299e95118313eddb4d2e07e04 (patch)
treee8d2255abc5c2c1d83b4176e78797c03e19a5aff /src
parent984794baf4af59da7f2496ecab33f2596d6619ff (diff)
core: a few small coding style/modernization updates for job.c
Diffstat (limited to 'src')
-rw-r--r--src/core/job.c12
-rw-r--r--src/core/job.h4
2 files changed, 7 insertions, 9 deletions
diff --git a/src/core/job.c b/src/core/job.c
index ac6910a906..7b492564ab 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -267,7 +267,8 @@ JobDependency* job_dependency_new(Job *subject, Job *object, bool matters, bool
* this means the 'anchor' job (i.e. the one the user
* explicitly asked for) is the requester. */
- if (!(l = new0(JobDependency, 1)))
+ l = new0(JobDependency, 1);
+ if (!l)
return NULL;
l->subject = subject;
@@ -457,9 +458,7 @@ static bool job_is_runnable(Job *j) {
if (j->type == JOB_NOP)
return true;
- if (j->type == JOB_START ||
- j->type == JOB_VERIFY_ACTIVE ||
- j->type == JOB_RELOAD) {
+ if (IN_SET(j->type, JOB_START, JOB_VERIFY_ACTIVE, JOB_RELOAD)) {
/* Immediate result is that the job is or might be
* started. In this case let's wait for the
@@ -476,8 +475,7 @@ static bool job_is_runnable(Job *j) {
SET_FOREACH(other, j->unit->dependencies[UNIT_BEFORE], i)
if (other->job &&
- (other->job->type == JOB_STOP ||
- other->job->type == JOB_RESTART))
+ IN_SET(other->job->type, JOB_STOP, JOB_RESTART))
return false;
/* This means that for a service a and a service b where b
@@ -1205,7 +1203,7 @@ int job_get_timeout(Job *j, usec_t *timeout) {
static const char* const job_state_table[_JOB_STATE_MAX] = {
[JOB_WAITING] = "waiting",
- [JOB_RUNNING] = "running"
+ [JOB_RUNNING] = "running",
};
DEFINE_STRING_TABLE_LOOKUP(job_state, JobState);
diff --git a/src/core/job.h b/src/core/job.h
index 85368f0d30..02560c41c5 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -122,8 +122,8 @@ struct JobDependency {
LIST_FIELDS(JobDependency, subject);
LIST_FIELDS(JobDependency, object);
- bool matters;
- bool conflicts;
+ bool matters:1;
+ bool conflicts:1;
};
struct Job {