kernel: timeout: avoid identifier collisions

MISRA-C Rule 5.3 states that identifiers in inner scope should
not hide identifiers in outer scope.

In the function z_set_timeout_expiry(), the parameter "idle"
and an inner variable "next" collide with function named idle()
and next(). So rename those variables.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung
2020-07-23 12:55:20 -07:00
committed by Anas Nashif
parent 2acafafae1
commit b907cf7694

View File

@@ -194,12 +194,13 @@ int32_t z_get_next_timeout_expiry(void)
return ret;
}
void z_set_timeout_expiry(int32_t ticks, bool idle)
void z_set_timeout_expiry(int32_t ticks, bool is_idle)
{
LOCKED(&timeout_lock) {
int next = next_timeout();
bool sooner = (next == K_TICKS_FOREVER) || (ticks < next);
bool imminent = next <= 1;
int next_to = next_timeout();
bool sooner = (next_to == K_TICKS_FOREVER)
|| (ticks < next_to);
bool imminent = next_to <= 1;
/* Only set new timeouts when they are sooner than
* what we have. Also don't try to set a timeout when
@@ -212,7 +213,7 @@ void z_set_timeout_expiry(int32_t ticks, bool idle)
* in.
*/
if (!imminent && (sooner || IS_ENABLED(CONFIG_SMP))) {
z_clock_set_timeout(ticks, idle);
z_clock_set_timeout(ticks, is_idle);
}
}
}