]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/mainloop.c
API: Include tbf.h and trie.h
[libucw.git] / ucw / mainloop.c
index e2b968268596df84bfaf1572a544e6d9acf14593..5fdc5ef42678146b194a0602aeb73e628fc65800 100644 (file)
@@ -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
        {
@@ -277,7 +277,7 @@ timer_add(struct main_timer *tm, timestamp_t expires)
          HEAP_DELETE(struct main_timer *, m->timer_table, num_timers, MAIN_TIMER_LESS, MAIN_TIMER_SWAP, tm->index);
          tm->index = 0;
          tm->expires = 0;
-         GARY_POP(m->timer_table, 1);
+         GARY_POP(m->timer_table);
        }
       else
        {