summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2007-12-12 00:17:08 +0000
committerroot <root>2007-12-12 00:17:08 +0000
commit4179355c2b48ffa197ae4cf21b521ccf0201436c (patch)
tree16fb37e1850cd18c21d3bd81f58f9e7399917c82
parent71cf1659dedacff243a2aa51499d4a75e48f9443 (diff)
fix some aliasing issues again
-rw-r--r--ev.c37
-rw-r--r--ev_vars.h4
2 files changed, 20 insertions, 21 deletions
diff --git a/ev.c b/ev.c
index 804002a..e87da22 100644
--- a/ev.c
+++ b/ev.c
@@ -654,7 +654,6 @@ upheap (WT *heap, int k)
heap [k] = w;
((W)heap [k])->active = k + 1;
-
}
void inline_speed
@@ -1217,7 +1216,7 @@ timers_reify (EV_P)
{
while (timercnt && ((WT)timers [0])->at <= mn_now)
{
- ev_timer *w = timers [0];
+ ev_timer *w = (ev_timer *)timers [0];
/*assert (("inactive timer on timer heap detected", ev_is_active (w)));*/
@@ -1230,7 +1229,7 @@ timers_reify (EV_P)
if (((WT)w)->at < mn_now)
((WT)w)->at = mn_now;
- downheap ((WT *)timers, timercnt, 0);
+ downheap (timers, timercnt, 0);
}
else
ev_timer_stop (EV_A_ w); /* nonrepeating: stop timer */
@@ -1245,7 +1244,7 @@ periodics_reify (EV_P)
{
while (periodiccnt && ((WT)periodics [0])->at <= ev_rt_now)
{
- ev_periodic *w = periodics [0];
+ ev_periodic *w = (ev_periodic *)periodics [0];
/*assert (("inactive timer on periodic heap detected", ev_is_active (w)));*/
@@ -1254,14 +1253,14 @@ periodics_reify (EV_P)
{
((WT)w)->at = w->reschedule_cb (w, ev_rt_now + TIME_EPSILON);
assert (("ev_periodic reschedule callback returned time in the past", ((WT)w)->at > ev_rt_now));
- downheap ((WT *)periodics, periodiccnt, 0);
+ downheap (periodics, periodiccnt, 0);
}
else if (w->interval)
{
((WT)w)->at = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
if (((WT)w)->at - ev_rt_now <= TIME_EPSILON) ((WT)w)->at += w->interval;
assert (("ev_periodic timeout in the past detected while processing timers, negative interval?", ((WT)w)->at > ev_rt_now));
- downheap ((WT *)periodics, periodiccnt, 0);
+ downheap (periodics, periodiccnt, 0);
}
else
ev_periodic_stop (EV_A_ w); /* nonrepeating: stop timer */
@@ -1278,7 +1277,7 @@ periodics_reschedule (EV_P)
/* adjust periodics after time jump */
for (i = 0; i < periodiccnt; ++i)
{
- ev_periodic *w = periodics [i];
+ ev_periodic *w = (ev_periodic *)periodics [i];
if (w->reschedule_cb)
((WT)w)->at = w->reschedule_cb (w, ev_rt_now);
@@ -1288,7 +1287,7 @@ periodics_reschedule (EV_P)
/* now rebuild the heap */
for (i = periodiccnt >> 1; i--; )
- downheap ((WT *)periodics, periodiccnt, i);
+ downheap (periodics, periodiccnt, i);
}
#endif
@@ -1631,9 +1630,9 @@ ev_timer_start (EV_P_ ev_timer *w)
assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.));
ev_start (EV_A_ (W)w, ++timercnt);
- array_needsize (ev_timer *, timers, timermax, timercnt, EMPTY2);
- timers [timercnt - 1] = w;
- upheap ((WT *)timers, timercnt - 1);
+ array_needsize (WT, timers, timermax, timercnt, EMPTY2);
+ timers [timercnt - 1] = (WT)w;
+ upheap (timers, timercnt - 1);
/*assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));*/
}
@@ -1645,7 +1644,7 @@ ev_timer_stop (EV_P_ ev_timer *w)
if (expect_false (!ev_is_active (w)))
return;
- assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));
+ assert (("internal timer heap corruption", timers [((W)w)->active - 1] == (WT)w));
{
int active = ((W)w)->active;
@@ -1653,7 +1652,7 @@ ev_timer_stop (EV_P_ ev_timer *w)
if (expect_true (--active < --timercnt))
{
timers [active] = timers [timercnt];
- adjustheap ((WT *)timers, timercnt, active);
+ adjustheap (timers, timercnt, active);
}
}
@@ -1670,7 +1669,7 @@ ev_timer_again (EV_P_ ev_timer *w)
if (w->repeat)
{
((WT)w)->at = mn_now + w->repeat;
- adjustheap ((WT *)timers, timercnt, ((W)w)->active - 1);
+ adjustheap (timers, timercnt, ((W)w)->active - 1);
}
else
ev_timer_stop (EV_A_ w);
@@ -1701,9 +1700,9 @@ ev_periodic_start (EV_P_ ev_periodic *w)
((WT)w)->at = w->offset;
ev_start (EV_A_ (W)w, ++periodiccnt);
- array_needsize (ev_periodic *, periodics, periodicmax, periodiccnt, EMPTY2);
- periodics [periodiccnt - 1] = w;
- upheap ((WT *)periodics, periodiccnt - 1);
+ array_needsize (WT, periodics, periodicmax, periodiccnt, EMPTY2);
+ periodics [periodiccnt - 1] = (WT)w;
+ upheap (periodics, periodiccnt - 1);
/*assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));*/
}
@@ -1715,7 +1714,7 @@ ev_periodic_stop (EV_P_ ev_periodic *w)
if (expect_false (!ev_is_active (w)))
return;
- assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));
+ assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == (WT)w));
{
int active = ((W)w)->active;
@@ -1723,7 +1722,7 @@ ev_periodic_stop (EV_P_ ev_periodic *w)
if (expect_true (--active < --periodiccnt))
{
periodics [active] = periodics [periodiccnt];
- adjustheap ((WT *)periodics, periodiccnt, active);
+ adjustheap (periodics, periodiccnt, active);
}
}
diff --git a/ev_vars.h b/ev_vars.h
index 951c45d..36e7485 100644
--- a/ev_vars.h
+++ b/ev_vars.h
@@ -63,12 +63,12 @@ VARx(int *, fdchanges)
VARx(int, fdchangemax)
VARx(int, fdchangecnt)
-VARx(struct ev_timer **, timers)
+VARx(WT *, timers)
VARx(int, timermax)
VARx(int, timercnt)
#if EV_PERIODIC_ENABLE || EV_GENWRAP
-VARx(struct ev_periodic **, periodics)
+VARx(WT *, periodics)
VARx(int, periodicmax)
VARx(int, periodiccnt)
#endif