diff --git a/lib/isc/timer.c b/lib/isc/timer.c index f7027f5625..7e56d6df1e 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -239,7 +239,11 @@ isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type, isc_task_t *task, isc_taskaction_t action, void *arg, isc_timer_t **timerp) { - isc__timermgr_t *manager = (isc__timermgr_t *)manager0; + REQUIRE(VALID_MANAGER(manager0)); + REQUIRE(task != NULL); + REQUIRE(action != NULL); + + isc__timermgr_t *manager; isc__timer_t *timer; isc_result_t result; isc_time_t now; @@ -251,10 +255,7 @@ isc_timer_create(isc_timermgr_t *manager0, isc_timertype_t type, * called with 'arg' as the arg value. The new timer is returned * in 'timerp'. */ - - REQUIRE(VALID_MANAGER(manager)); - REQUIRE(task != NULL); - REQUIRE(action != NULL); + manager = (isc__timermgr_t *)manager0; if (expires == NULL) expires = isc_time_epoch; if (interval == NULL) @@ -352,7 +353,7 @@ isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, bool purge) { - isc__timer_t *timer = (isc__timer_t *)timer0; + isc__timer_t *timer; isc_time_t now; isc__timermgr_t *manager; isc_result_t result; @@ -363,7 +364,8 @@ isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type, * are purged from its task's event queue. */ - REQUIRE(VALID_TIMER(timer)); + REQUIRE(VALID_TIMER(timer0)); + timer = (isc__timer_t *)timer0; manager = timer->manager; REQUIRE(VALID_MANAGER(manager)); @@ -425,10 +427,11 @@ isc_timer_reset(isc_timer_t *timer0, isc_timertype_t type, isc_timertype_t isc_timer_gettype(isc_timer_t *timer0) { - isc__timer_t *timer = (isc__timer_t *)timer0; + isc__timer_t *timer; isc_timertype_t t; - REQUIRE(VALID_TIMER(timer)); + REQUIRE(VALID_TIMER(timer0)); + timer = (isc__timer_t *)timer0; LOCK(&timer->lock); t = timer->type; @@ -439,7 +442,7 @@ isc_timer_gettype(isc_timer_t *timer0) { isc_result_t isc_timer_touch(isc_timer_t *timer0) { - isc__timer_t *timer = (isc__timer_t *)timer0; + isc__timer_t *timer; isc_result_t result; isc_time_t now; @@ -447,7 +450,8 @@ isc_timer_touch(isc_timer_t *timer0) { * Set the last-touched time of 'timer' to the current time. */ - REQUIRE(VALID_TIMER(timer)); + REQUIRE(VALID_TIMER(timer0)); + timer = (isc__timer_t *)timer0; LOCK(&timer->lock); @@ -470,13 +474,14 @@ isc_timer_touch(isc_timer_t *timer0) { void isc_timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) { - isc__timer_t *timer = (isc__timer_t *)timer0; + isc__timer_t *timer; /* * Attach *timerp to timer. */ - REQUIRE(VALID_TIMER(timer)); + REQUIRE(VALID_TIMER(timer0)); + timer = (isc__timer_t *)timer0; REQUIRE(timerp != NULL && *timerp == NULL); isc_refcount_increment(&timer->references); @@ -661,8 +666,8 @@ static void set_index(void *what, unsigned int index) { isc__timer_t *timer; + REQUIRE(VALID_TIMER(what)); timer = what; - REQUIRE(VALID_TIMER(timer)); timer->index = index; } @@ -707,9 +712,10 @@ isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { void isc_timermgr_poke(isc_timermgr_t *manager0) { - isc__timermgr_t *manager = (isc__timermgr_t *)manager0; + isc__timermgr_t *manager; - REQUIRE(VALID_MANAGER(manager)); + REQUIRE(VALID_MANAGER(manager0)); + manager = (isc__timermgr_t *)manager0; SIGNAL(&manager->wakeup); }