summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-11-16 15:28:26 +0100
committerLennart Poettering <lennart@poettering.net>2018-11-16 15:30:36 +0100
commitff30a86bd41c02da3f2a527f882989bdf4534641 (patch)
tree2ef17caa9257f8f7b3cf76f9b4902a29cc475873 /src/core
parentjob: when a job was skipped due to a failed condition, log about it (diff)
downloadsystemd-ff30a86bd41c02da3f2a527f882989bdf4534641.tar.xz
systemd-ff30a86bd41c02da3f2a527f882989bdf4534641.zip
job: simplify status message extraction
As @keszybz points out these fields are always here, there's no point in checking if they are NULL or not.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/job.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/core/job.c b/src/core/job.c
index ec1113f2dd..8f36e02eb9 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -510,7 +510,6 @@ static void job_change_type(Job *j, JobType newtype) {
}
_pure_ static const char* job_get_begin_status_message_format(Unit *u, JobType t) {
- const UnitStatusMessageFormats *format_table;
const char *format;
assert(u);
@@ -520,12 +519,9 @@ _pure_ static const char* job_get_begin_status_message_format(Unit *u, JobType t
assert(IN_SET(t, JOB_START, JOB_STOP));
- format_table = &UNIT_VTABLE(u)->status_message_formats;
- if (format_table) {
- format = format_table->starting_stopping[t == JOB_STOP];
- if (format)
- return format;
- }
+ format = UNIT_VTABLE(u)->status_message_formats.starting_stopping[t == JOB_STOP];
+ if (format)
+ return format;
/* Return generic strings */
if (t == JOB_START)
@@ -766,7 +762,6 @@ _pure_ static const char *job_get_done_status_message_format(Unit *u, JobType t,
[JOB_SKIPPED] = "%s is not active.",
};
- const UnitStatusMessageFormats *format_table;
const char *format;
assert(u);
@@ -774,13 +769,11 @@ _pure_ static const char *job_get_done_status_message_format(Unit *u, JobType t,
assert(t < _JOB_TYPE_MAX);
if (IN_SET(t, JOB_START, JOB_STOP, JOB_RESTART)) {
- format_table = &UNIT_VTABLE(u)->status_message_formats;
- if (format_table) {
- format = t == JOB_START ? format_table->finished_start_job[result] :
- format_table->finished_stop_job[result];
- if (format)
- return format;
- }
+ format = t == JOB_START ?
+ UNIT_VTABLE(u)->status_message_formats.finished_start_job[result] :
+ UNIT_VTABLE(u)->status_message_formats.finished_stop_job[result];
+ if (format)
+ return format;
}
/* Return generic strings */