]> git.llucax.com Git - software/libev.git/commitdiff
remove pointless and buggy active check
authorroot <root>
Thu, 1 Nov 2007 08:28:33 +0000 (08:28 +0000)
committerroot <root>
Thu, 1 Nov 2007 08:28:33 +0000 (08:28 +0000)
ev.c

diff --git a/ev.c b/ev.c
index 8c3bf01ba6f2818393d0b45a94ebeddc1d8c7db8..3a177c587b804fd80050d8cb543f940a9ce02ff1 100644 (file)
--- a/ev.c
+++ b/ev.c
@@ -115,8 +115,7 @@ get_clock (void)
   return ev_time ();
 }
 
   return ev_time ();
 }
 
-#define array_nextsize(n) (((n) << 1) | 4 & ~3)
-#define array_prevsize(n) (((n) >> 1) | 4 & ~3)
+#define array_roundsize(base,n) ((n) | 4 & ~3)
 
 #define array_needsize(base,cur,cnt,init)              \
   if ((cnt) > cur)                                     \
 
 #define array_needsize(base,cur,cnt,init)              \
   if ((cnt) > cur)                                     \
@@ -124,7 +123,7 @@ get_clock (void)
       int newcnt = cur;                                        \
       do                                               \
         {                                              \
       int newcnt = cur;                                        \
       do                                               \
         {                                              \
-          newcnt = array_nextsize (newcnt);            \
+          newcnt = array_roundsize (base, newcnt << 1);        \
         }                                              \
       while ((cnt) > newcnt);                          \
                                                        \
         }                                              \
       while ((cnt) > newcnt);                          \
                                                        \
@@ -167,13 +166,10 @@ static int pendingmax, pendingcnt;
 static void
 event (W w, int events)
 {
 static void
 event (W w, int events)
 {
-  if (w->active)
-    {
-      w->pending = ++pendingcnt;
-      array_needsize (pendings, pendingmax, pendingcnt, );
-      pendings [pendingcnt - 1].w      = w;
-      pendings [pendingcnt - 1].events = events;
-    }
+  w->pending = ++pendingcnt;
+  array_needsize (pendings, pendingmax, pendingcnt, );
+  pendings [pendingcnt - 1].w      = w;
+  pendings [pendingcnt - 1].events = events;
 }
 
 static void
 }
 
 static void
@@ -531,8 +527,6 @@ timers_reify (void)
     {
       struct ev_timer *w = timers [0];
 
     {
       struct ev_timer *w = timers [0];
 
-      event ((W)w, EV_TIMEOUT);
-
       /* first reschedule or stop timer */
       if (w->repeat)
         {
       /* first reschedule or stop timer */
       if (w->repeat)
         {
@@ -542,6 +536,8 @@ timers_reify (void)
         }
       else
         ev_timer_stop (w); /* nonrepeating: stop timer */
         }
       else
         ev_timer_stop (w); /* nonrepeating: stop timer */
+
+      event ((W)w, EV_TIMEOUT);
     }
 }
 
     }
 }