From 60933bb89b3fe9be65d1ca6fec78b715c5714f66 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 28 Feb 2018 15:07:30 +0000 Subject: [PATCH] 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`). --- src/core/timer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/timer.c b/src/core/timer.c index 133cbb974d..1770c593f8 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) {