timer slot by looking for its settings */
for (timer = 0; timer < nTimers; timer++) {
/* skip inactive (i.e. deleted) timers */
- if (Timers[timer].active == 0)
+ if (Timers[timer].active == TIMER_INACTIVE)
continue;
if (Timers[timer].callback == callback && Timers[timer].data == data) {
/* we have found the timer slot, so mark it as being inactive;
we will not actually delete the slot, so its allocated
memory may be re-used */
- Timers[timer].active = 0;
+ Timers[timer].active = TIMER_INACTIVE;
/* signal successful timer removal */
return 0;
/* try to minimize memory usage by looping through the timer slots
and looking for an inactive timer */
for (timer = 0; timer < nTimers; timer++) {
- if (Timers[timer].active == 0) {
+ if (Timers[timer].active == TIMER_INACTIVE) {
/* we've just found one, so let's reuse it ("timer" holds its
ID) by breaking the loop */
break;
/* set timer to active so that it is processed and not overwritten
by the memory optimization routine above */
- Timers[timer].active = 1;
+ Timers[timer].active = TIMER_ACTIVE;
/* one-shot timers should NOT fire immediately, so delay them by a
single timer interval */
by looking for its settings */
for (timer = 0; timer < nTimers; timer++) {
/* skip inactive (i.e. deleted) timers */
- if (Timers[timer].active == 0)
+ if (Timers[timer].active == TIMER_INACTIVE)
continue;
if (Timers[timer].callback == callback && Timers[timer].data == data && Timers[timer].interval == interval) {
/* process all expired timers */
for (timer = 0; timer < nTimers; timer++) {
/* skip inactive (i.e. deleted) timers */
- if (Timers[timer].active == 0)
+ if (Timers[timer].active == TIMER_INACTIVE)
continue;
/* check whether current timer needs to be processed, i.e. the
if (Timers[timer].one_shot) {
/* mark one-shot timer as inactive (which means the timer has
been deleted and its allocated memory may be re-used) */
- Timers[timer].active = 0;
+ Timers[timer].active = TIMER_INACTIVE;
} else {
/* otherwise, re-spawn timer by adding one triggering interval
to its triggering time */
timer */
for (timer = 0; timer < nTimers; timer++) {
/* skip inactive (i.e. deleted) timers */
- if (Timers[timer].active == 0)
+ if (Timers[timer].active == TIMER_INACTIVE)
continue;
/* if this is the first timer that we check, mark it as the next
/* process all timers */
for (timer = 0; timer < nTimers; timer++) {
/* skip inactive (i.e. deleted) timers */
- if (Timers[timer].active == 0)
+ if (Timers[timer].active == TIMER_INACTIVE)
continue;
/* correct timer's time stamp by clock skew */
matches the specified interval */
for (group = 0; group < nTimerGroups; group++) {
/* skip inactive (i.e. deleted) timer groups */
- if (TimerGroups[group].active == 0)
+ if (TimerGroups[group].active == TIMER_INACTIVE)
continue;
if (*TimerGroups[group].interval == interval) {
/* try to minimize memory usage by looping through timer group
slots and looking for an inactive timer group */
for (group = 0; group < nTimerGroups; group++) {
- if (TimerGroups[group].active == 0) {
+ if (TimerGroups[group].active == TIMER_INACTIVE) {
/* we've just found one, so let's reuse it ("group" holds its
ID) by breaking the loop */
break;
/* set timer group to active so that it is processed and not
overwritten by the memory optimization routine above */
- TimerGroups[group].active = 1;
+ TimerGroups[group].active = TIMER_ACTIVE;
/* finally, request a generic timer that calls this group and
signal success or failure */
with the specified update interval */
for (widget = 0; widget < nTimerGroupWidgets; widget++) {
/* skip inactive (i.e. deleted) widget slots */
- if (TimerGroupWidgets[widget].active == 0)
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
continue;
if (TimerGroupWidgets[widget].interval == interval) {
/* we have found a matching widget slot, so mark it as being
inactive; we will not actually delete the slot, so its
allocated memory may be re-used */
- TimerGroupWidgets[widget].active = 0;
+ TimerGroupWidgets[widget].active = TIMER_INACTIVE;
}
}
timer group slot by looking for its settings */
for (group = 0; group < nTimerGroups; group++) {
/* skip inactive (i.e. deleted) timer groups */
- if (TimerGroups[group].active == 0)
+ if (TimerGroups[group].active == TIMER_INACTIVE)
continue;
if (*TimerGroups[group].interval == interval) {
/* we have found the timer group slot, so mark it as being
inactive; we will not actually delete the slot, so its
allocated memory may be re-used */
- TimerGroups[group].active = 0;
+ TimerGroups[group].active = TIMER_INACTIVE;
/* remove the generic timer that calls this group */
if (timer_remove(timer_process_group, TimerGroups[group].interval)) {
specified update interval */
for (widget = 0; widget < nTimerGroupWidgets; widget++) {
/* skip inactive (i.e. deleted) widget slots */
- if (TimerGroupWidgets[widget].active == 0)
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
continue;
/* at least one other widget with specified update interval
group's update interval */
for (widget = 0; widget < nTimerGroupWidgets; widget++) {
/* skip inactive (i.e. deleted) widgets */
- if (TimerGroupWidgets[widget].active == 0)
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
continue;
/* the current widget belongs to the specified timer group */
/* mark one-shot widget as inactive (which means the it has
been deleted and its allocated memory may be re-used) */
if (TimerGroupWidgets[widget].one_shot) {
- TimerGroupWidgets[widget].active = 0;
+ TimerGroupWidgets[widget].active = TIMER_INACTIVE;
/* also remove the corresponding timer group if it is empty */
timer_remove_empty_group(interval);
/* try to minimize memory usage by looping through the widget
slots and looking for an inactive widget slot */
for (widget = 0; widget < nTimerGroupWidgets; widget++) {
- if (TimerGroupWidgets[widget].active == 0) {
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE) {
/* we've just found one, so let's reuse it ("widget" holds its
ID) by breaking the loop */
break;
/* set widget slot to active so that it is processed and not
overwritten by the memory optimization routine above */
- TimerGroupWidgets[widget].active = 1;
+ TimerGroupWidgets[widget].active = TIMER_ACTIVE;
/* signal successful addition of widget slot */
return 0;
widget slot by looking for its settings */
for (widget = 0; widget < nTimerGroupWidgets; widget++) {
/* skip inactive (i.e. deleted) widget slots */
- if (TimerGroupWidgets[widget].active == 0)
+ if (TimerGroupWidgets[widget].active == TIMER_INACTIVE)
continue;
if (TimerGroupWidgets[widget].callback == callback && TimerGroupWidgets[widget].data == data) {
/* we have found the widget slot, so mark it as being
inactive; we will not actually delete the slot, so its
allocated memory may be re-used */
- TimerGroupWidgets[widget].active = 0;
+ TimerGroupWidgets[widget].active = TIMER_INACTIVE;
/* store the widget's triggering interval for later use and
break the loop */