Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-04-01 02:11:51 UTC

Modified files:
  Tag: u2_10_12_branch
     ircd/ircd_events.c include/ircd_events.h ChangeLog

Log message:

Avoid triggering warnings about strict-aliasing violations.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.172 ircu2.10/ChangeLog:1.710.2.173
--- ircu2.10/ChangeLog:1.710.2.172      Tue Mar 27 21:04:32 2007
+++ ircu2.10/ChangeLog  Sat Mar 31 19:11:41 2007
@@ -1,3 +1,16 @@
+2007-03-31  Michael Poole <[EMAIL PROTECTED]>
+
+       * include/ircd_events.h (struct Generators): Convert elements to
+       be struct GenHeader*.
+       (timer_next): Update to match.
+
+       * ircd/ircd_events.c (timer_enqueue): Update to match.
+       (signal_callback): Likewise.
+       (timer_init): Remove a typecast with something slightly safer.
+       (timer_run): Update to deal with new type of Generator.g_timer.
+       (signal_add): Likewise.
+       (socket_add): Likewise.
+       
 2007-03-28  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/m_asll.c (ms_asll): Count hits and report at the end, so
Index: ircu2.10/include/ircd_events.h
diff -u ircu2.10/include/ircd_events.h:1.5 
ircu2.10/include/ircd_events.h:1.5.2.1
--- ircu2.10/include/ircd_events.h:1.5  Mon Oct  4 21:14:44 2004
+++ ircu2.10/include/ircd_events.h      Sat Mar 31 19:11:41 2007
@@ -20,7 +20,7 @@
  */
 /** @file
  * @brief Interface and public definitions for event loop.
- * @version $Id: ircd_events.h,v 1.5 2004/10/05 04:14:44 entrope Exp $
+ * @version $Id: ircd_events.h,v 1.5.2.1 2007/04/01 02:11:41 entrope Exp $
  */
 
 #ifndef INCLUDED_config_h
@@ -202,9 +202,9 @@
 
 /** List of all event generators. */
 struct Generators {
-  struct Socket* g_socket;     /**< list of socket generators */
-  struct Signal* g_signal;     /**< list of signal generators */
-  struct Timer*         g_timer;       /**< list of timer generators */
+  struct GenHeader* g_socket;  /**< list of socket generators */
+  struct GenHeader* g_signal;  /**< list of signal generators */
+  struct GenHeader* g_timer;   /**< list of timer generators */
 };
 
 /** Returns 1 if successfully initialized, 0 if not.
@@ -284,7 +284,7 @@
 void timer_chg(struct Timer* timer, enum TimerType type, time_t value);
 void timer_run(void);
 /** Retrieve the next timer's expiration time from Generators \a gen. */
-#define timer_next(gen)        ((gen)->g_timer ? (gen)->g_timer->t_expire : 0)
+#define timer_next(gen)        ((gen)->g_timer ? ((struct 
Timer*)(gen)->g_timer)->t_expire : 0)
 
 void signal_add(struct Signal* signal, EventCallBack call, void* data,
                int sig);
Index: ircu2.10/ircd/ircd_events.c
diff -u ircu2.10/ircd/ircd_events.c:1.10 ircu2.10/ircd/ircd_events.c:1.10.2.1
--- ircu2.10/ircd/ircd_events.c:1.10    Tue Mar 22 16:30:56 2005
+++ ircu2.10/ircd/ircd_events.c Sat Mar 31 19:11:41 2007
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Implementation of event loop mid-layer.
- * @version $Id: ircd_events.c,v 1.10 2005/03/23 00:30:56 entrope Exp $
+ * @version $Id: ircd_events.c,v 1.10.2.1 2007/04/01 02:11:41 entrope Exp $
  */
 #include "config.h"
 
@@ -246,7 +246,7 @@
 static void
 timer_enqueue(struct Timer* timer)
 {
-  struct Timer** ptr_p;
+  struct GenHeader** ptr_p;
 
   assert(0 != timer);
   assert(0 == timer->t_header.gh_prev_p); /* not already on queue */
@@ -265,16 +265,16 @@
 
   /* Find a slot to insert timer */
   for (ptr_p = &evInfo.gens.g_timer; ;
-       ptr_p = (struct Timer**) &(*ptr_p)->t_header.gh_next)
-    if (!*ptr_p || timer->t_expire < (*ptr_p)->t_expire)
+       ptr_p = &(*ptr_p)->gh_next)
+    if (!*ptr_p || timer->t_expire < ((struct Timer*)*ptr_p)->t_expire)
       break;
 
   /* link it in the right place */
-  timer->t_header.gh_next = (struct GenHeader*) *ptr_p;
-  timer->t_header.gh_prev_p = (struct GenHeader**) ptr_p;
+  timer->t_header.gh_next = *ptr_p;
+  timer->t_header.gh_prev_p = ptr_p;
   if (*ptr_p)
-    (*ptr_p)->t_header.gh_prev_p = &timer->t_header.gh_next;
-  *ptr_p = timer;
+    (*ptr_p)->gh_prev_p = &timer->t_header.gh_next;
+  *ptr_p = &timer->t_header;
 }
 
 /** &Signal handler for writing signal notification to pipe.
@@ -300,7 +300,7 @@
 {
   unsigned char sigstr[SIGS_PER_SOCK];
   int sig, n_sigs, i;
-  struct Signal* ptr;
+  struct GenHeader* ptr;
 
   assert(event->ev_type == ET_READ); /* readable events only */
 
@@ -310,8 +310,8 @@
     sig = (int) sigstr[i]; /* get signal */
 
     for (ptr = evInfo.gens.g_signal; ptr;
-        ptr = (struct Signal*) ptr->sig_header.gh_next)
-      if (ptr->sig_signal == sig) /* find its descriptor... */
+        ptr = ptr->gh_next)
+      if (((struct Signal*)ptr)->sig_signal == sig) /* find its descriptor... 
*/
        break;
 
     if (ptr)
@@ -447,7 +447,7 @@
 struct Timer*
 timer_init(struct Timer* timer)
 {
-  gen_init((struct GenHeader*) timer, 0, 0, 0, 0);
+  gen_init(&timer->t_header, 0, 0, 0, 0);
 
   timer->t_header.gh_flags = 0; /* turn off active flag */
 
@@ -548,7 +548,7 @@
   struct Timer* ptr;
 
   /* go through queue... */
-  while ((ptr = evInfo.gens.g_timer)) {
+  while ((ptr = (struct Timer*)evInfo.gens.g_timer)) {
     if (CurrentTime < ptr->t_expire)
       break; /* processed all pending timers */
 
@@ -587,9 +587,9 @@
   assert(0 != evInfo.engine);
 
   /* set up struct */
-  gen_init((struct GenHeader*) signal, call, data,
-          (struct GenHeader*) evInfo.gens.g_signal,
-          (struct GenHeader**) &evInfo.gens.g_signal);
+  gen_init(&signal->sig_header, call, data,
+          evInfo.gens.g_signal,
+          &evInfo.gens.g_signal);
 
   signal->sig_signal = sig;
 
@@ -623,9 +623,9 @@
   assert(0 != evInfo.engine->eng_add);
 
   /* set up struct */
-  gen_init((struct GenHeader*) sock, call, data,
-          (struct GenHeader*) evInfo.gens.g_socket,
-          (struct GenHeader**) &evInfo.gens.g_socket);
+  gen_init(&sock->s_header, call, data,
+          evInfo.gens.g_socket,
+          &evInfo.gens.g_socket);
 
   sock->s_state = state;
   sock->s_events = events & SOCK_EVENT_MASK;
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to