From: Mark Andrews Date: Thu, 30 Jan 2020 07:19:11 +0000 (+1100) Subject: delay assignment until after REQUIRE X-Git-Tag: v9.14.11~20^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71a55892eb83fcd3c640755f35e79f3263ac781c;p=thirdparty%2Fbind9.git delay assignment until after REQUIRE (cherry picked from commit c65c06301c56860b5b75bbbc42c00f6459a646f8) --- diff --git a/lib/isc/timer.c b/lib/isc/timer.c index bd8a1c4ea56..201fba93302 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -240,7 +240,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; @@ -252,10 +256,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) @@ -355,7 +356,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; @@ -366,7 +367,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)); @@ -428,10 +430,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; @@ -442,7 +445,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; @@ -450,7 +453,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); @@ -473,13 +477,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); LOCK(&timer->lock); @@ -674,8 +679,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; } @@ -732,9 +737,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); }