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`).
This commit is contained in:
Alan Jenkins 2018-02-28 15:07:30 +00:00
parent 8c89cb5a50
commit 60933bb89b

View file

@ -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) {