1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

job: let's remove one comparison and reduce indentation level by one

This commit is contained in:
Lennart Poettering 2018-11-14 11:01:14 +01:00
parent 523ee2d414
commit a69b3872ac

View File

@ -510,28 +510,30 @@ static void job_change_type(Job *j, JobType newtype) {
} }
_pure_ static const char* job_get_begin_status_message_format(Unit *u, JobType t) { _pure_ static const char* job_get_begin_status_message_format(Unit *u, JobType t) {
const char *format;
const UnitStatusMessageFormats *format_table; const UnitStatusMessageFormats *format_table;
const char *format;
assert(u); assert(u);
assert(IN_SET(t, JOB_START, JOB_STOP, JOB_RELOAD));
if (t != JOB_RELOAD) { if (t == JOB_RELOAD)
format_table = &UNIT_VTABLE(u)->status_message_formats; return "Reloading %s.";
if (format_table) {
format = format_table->starting_stopping[t == JOB_STOP]; assert(IN_SET(t, JOB_START, JOB_STOP));
if (format)
return format; format_table = &UNIT_VTABLE(u)->status_message_formats;
} if (format_table) {
format = format_table->starting_stopping[t == JOB_STOP];
if (format)
return format;
} }
/* Return generic strings */ /* Return generic strings */
if (t == JOB_START) if (t == JOB_START)
return "Starting %s."; return "Starting %s.";
else if (t == JOB_STOP) else {
assert(t == JOB_STOP);
return "Stopping %s."; return "Stopping %s.";
else }
return "Reloading %s.";
} }
static void job_print_begin_status_message(Unit *u, JobType t) { static void job_print_begin_status_message(Unit *u, JobType t) {