X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ucw%2Fmainloop.c;h=b5e54965bb87de3e8fab2b3ba877b4c491553832;hb=92b3bd34e6024ec20c67e3c1285f3a442fe6f326;hp=e2b968268596df84bfaf1572a544e6d9acf14593;hpb=12b2eb1c3f53b2b73b2c916dd907c04834f70fde;p=libucw.git diff --git a/ucw/mainloop.c b/ucw/mainloop.c index e2b96826..b5e54965 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -259,9 +259,9 @@ timer_add(struct main_timer *tm, timestamp_t expires) if (!tm->expires) { tm->expires = expires; - tm->index = num_timers; + tm->index = num_timers + 1; GARY_RESIZE(m->timer_table, num_timers + 2); - HEAP_INSERT(struct main_timer *, m->timer_table, tm->index, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm); + HEAP_INSERT(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm); } else {