misc: Point to correct simavr include dirs
[simavr] / simavr / sim / sim_cycle_timers.c
index 5b362e9..170aeed 100644 (file)
@@ -59,7 +59,7 @@ avr_cycle_timer_insert(
 
        when += avr->cycle;
 
-       // find it's place int the list
+       // find its place in the list
        int inserti = 0;
        while (inserti < pool->count && pool->timer[inserti].when > when)
                inserti++;
@@ -68,11 +68,11 @@ avr_cycle_timer_insert(
        if (cnt)
                memmove(&pool->timer[inserti + 1], &pool->timer[inserti],
                                cnt * sizeof(avr_cycle_timer_slot_t));
-       pool->count++;
 
        pool->timer[inserti].timer = timer;
        pool->timer[inserti].param = param;
        pool->timer[inserti].when = when;
+       pool->count++;
        DEBUG(printf("%s %2d/%2d when %7d %p/%p\n", __func__, inserti, pool->count, (int)(when - avr->cycle), timer, param);)
        DUMP(pool, "after");
 }
@@ -90,7 +90,7 @@ avr_cycle_timer_register(
        avr_cycle_timer_cancel(avr, timer, param);
 
        if (pool->count == MAX_CYCLE_TIMERS) {
-               fprintf(stderr, "%s: pool is full (%d)!\n", __func__, MAX_CYCLE_TIMERS);
+               AVR_LOG(avr, LOG_ERROR, "CYCLE: %s: pool is full (%d)!\n", __func__, MAX_CYCLE_TIMERS);
                return;
        }
        avr_cycle_timer_insert(avr, when, timer, param);
@@ -148,7 +148,7 @@ avr_cycle_timer_status(
 }
 
 /*
- * run thru all the timers, call the ones that needs it,
+ * run through all the timers, call the ones that needs it,
  * clear the ones that wants it, and calculate the next
  * potential cycle we could sleep for...
  */