X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=ucw%2Fmainloop.c;h=b5e54965bb87de3e8fab2b3ba877b4c491553832;hb=c0e08a14cb5681faac6bd4b2567fe153f2421273;hp=b2b07c5082476bedbdc023e094f49f6feb02a28b;hpb=46a15649d1e544dce95f76424a4870d69caa955c;p=libucw.git diff --git a/ucw/mainloop.c b/ucw/mainloop.c index b2b07c50..b5e54965 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -260,13 +260,13 @@ timer_add(struct main_timer *tm, timestamp_t expires) { tm->expires = expires; tm->index = num_timers + 1; - *GARY_PUSH(m->timer_table, 1) = tm; - HEAP_INSERT(struct main_timer *, m->timer_table, tm->index, MAIN_TIMER_LESS, MAIN_TIMER_SWAP); + GARY_RESIZE(m->timer_table, num_timers + 2); + HEAP_INSERT(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm); } else { tm->expires = expires; - HEAP_INCREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index); + HEAP_INCREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index, tm); } } else if (tm->expires > expires) @@ -282,7 +282,7 @@ timer_add(struct main_timer *tm, timestamp_t expires) else { tm->expires = expires; - HEAP_DECREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index); + HEAP_DECREASE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index, tm); } } }