From: Alan Jenkins Date: Wed, 28 Feb 2018 15:07:30 +0000 (+0000) Subject: core: timer_enter_waiting(): refactor `base` local variable X-Git-Tag: v238~25^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=60933bb89b3fe9be65d1ca6fec78b715c5714f66;p=thirdparty%2Fsystemd.git core: timer_enter_waiting(): refactor `base` local variable We have two variables `b` and `base`. `b` is declared within limited scope; `base` is declared at the top of the function. However `base` is actually only used within a scope which is exclusive of `b`. Clarify by moving `base` inside the limited scope as well. (Also `base` doesn't need initializing any more than `b` does. The declaration of `base` is now immediately followed by a case analysis of `v->base`, which serves almost exclusively to determine the value of `base`). --- diff --git a/src/core/timer.c b/src/core/timer.c index 133cbb974de..1770c593f81 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -354,7 +354,6 @@ static void timer_enter_waiting(Timer *t, bool initial) { bool found_monotonic = false, found_realtime = false; bool leave_around = false; triple_timestamp ts; - usec_t base = 0; TimerValue *v; Unit *trigger; int r; @@ -372,7 +371,6 @@ static void timer_enter_waiting(Timer *t, bool initial) { t->next_elapse_monotonic_or_boottime = t->next_elapse_realtime = 0; LIST_FOREACH(value, v, t->values) { - if (v->disabled) continue; @@ -397,7 +395,8 @@ static void timer_enter_waiting(Timer *t, bool initial) { found_realtime = true; - } else { + } else { + usec_t base; switch (v->base) {