| 181 | } |
| 182 | |
| 183 | static inline void remove_active_timer(uc_engine *uc, struct Timer *tim) { |
| 184 | struct TimerState* timers = &uc->fw->timers; |
| 185 | struct Timer *cursor = timers->active_head; |
| 186 | |
| 187 | sync_timers(uc); |
| 188 | |
| 189 | if(cursor == tim ) { |
| 190 | // We are changing the front, so also the intermediate ticks |
| 191 | timers->active_head = tim->next; |
| 192 | timers->cur_countdown = timers->cur_interval = timers->active_head->ticker_val; |
| 193 | uc->set_timer_countdown(uc->ctx, uc->fw->timers.cur_countdown); |
| 194 | } else { |
| 195 | // We are changing something in the middle, we can just unlink it |
| 196 | for(; cursor->next != tim; cursor = cursor->next); |
| 197 | cursor->next = tim->next; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | static inline void sort_timer_back(struct TimerState* timers, struct Timer *tim) { |
| 202 | struct Timer *cursor; |
no test coverage detected