--- libev/ev.c 2007/11/27 19:41:52 1.150 +++ libev/ev.c 2007/11/27 19:59:08 1.151 @@ -854,7 +854,7 @@ return backend; } -static void +static void noinline loop_init (EV_P_ unsigned int flags) { if (!backend) @@ -902,7 +902,7 @@ } } -static void +static void noinline loop_destroy (EV_P) { int i; @@ -939,7 +939,7 @@ backend = 0; } -static void +void inline_size loop_fork (EV_P) { #if EV_USE_PORT @@ -1099,7 +1099,7 @@ if (expect_true (p->w)) { - assert (("non-pending watcher on pending list", p->w->pending)); + /*assert (("non-pending watcher on pending list", p->w->pending));*/ p->w->pending = 0; EV_CB_INVOKE (p->w, p->events); @@ -1114,7 +1114,7 @@ { ev_timer *w = timers [0]; - assert (("inactive timer on timer heap detected", ev_is_active (w))); + /*assert (("inactive timer on timer heap detected", ev_is_active (w)));*/ /* first reschedule or stop timer */ if (w->repeat) @@ -1142,7 +1142,7 @@ { ev_periodic *w = periodics [0]; - assert (("inactive timer on periodic heap detected", ev_is_active (w))); + /*assert (("inactive timer on periodic heap detected", ev_is_active (w)));*/ /* first reschedule or stop timer */ if (w->reschedule_cb) @@ -1484,7 +1484,7 @@ timers [timercnt - 1] = w; upheap ((WT *)timers, timercnt - 1); - assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); + /*assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));*/ } void @@ -1496,11 +1496,15 @@ assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); - if (expect_true (((W)w)->active < timercnt--)) - { - timers [((W)w)->active - 1] = timers [timercnt]; - adjustheap ((WT *)timers, timercnt, ((W)w)->active - 1); - } + { + int active = ((W)w)->active; + + if (expect_true (--active < --timercnt)) + { + timers [active] = timers [timercnt]; + adjustheap ((WT *)timers, timercnt, active); + } + } ((WT)w)->at -= mn_now; @@ -1548,7 +1552,7 @@ periodics [periodiccnt - 1] = w; upheap ((WT *)periodics, periodiccnt - 1); - assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); + /*assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));*/ } void @@ -1560,11 +1564,15 @@ assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); - if (expect_true (((W)w)->active < periodiccnt--)) - { - periodics [((W)w)->active - 1] = periodics [periodiccnt]; - adjustheap ((WT *)periodics, periodiccnt, ((W)w)->active - 1); - } + { + int active = ((W)w)->active; + + if (expect_true (--active < --periodiccnt)) + { + periodics [active] = periodics [periodiccnt]; + adjustheap ((WT *)periodics, periodiccnt, active); + } + } ev_stop (EV_A_ (W)w); }