core: introduce a helper function to wrap unit_log_{success,failure}

It's inline so that the compiler can easily optimize away the call to get
status string.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-11-16 19:47:07 +01:00
parent 14c4da2ffe
commit aac99f303a
8 changed files with 14 additions and 34 deletions
+1 -5
View File
@@ -288,11 +288,7 @@ static void timer_enter_dead(Timer *t, TimerResult f) {
if (t->result == TIMER_SUCCESS)
t->result = f;
if (t->result == TIMER_SUCCESS)
unit_log_success(UNIT(t));
else
unit_log_failure(UNIT(t), timer_result_to_string(t->result));
unit_log_result(UNIT(t), t->result == TIMER_SUCCESS, timer_result_to_string(t->result));
timer_set_state(t, t->result != TIMER_SUCCESS ? TIMER_FAILED : TIMER_DEAD);
}