OSSP CVS Repository

ossp - Difference in ossp-pkg/pth/pth_event.c versions 1.63 and 1.64
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/pth/pth_event.c 1.63 -> 1.64

--- pth_event.c  2004/07/13 11:00:43     1.63
+++ pth_event.c  2004/09/12 11:27:32     1.64
@@ -30,6 +30,10 @@
 
 #if cpp
 
+/* pre-declare type of function event callback
+   (mainly to workaround va_arg(3) problems below) */
+typedef int (*pth_event_func_t)(void *);
+
 /* event structure */
 struct pth_event_st {
     struct pth_event_st *ev_next;
@@ -38,15 +42,15 @@
     int ev_type;
     int ev_goal;
     union {
-        struct { int fd; }                                        FD;
-        struct { int *n; int nfd; fd_set *rfds, *wfds, *efds; }   SELECT;
-        struct { sigset_t *sigs; int *sig; }                      SIGS;
-        struct { pth_time_t tv; }                                 TIME;
-        struct { pth_msgport_t mp; }                              MSG;
-        struct { pth_mutex_t *mutex; }                            MUTEX;
-        struct { pth_cond_t *cond; }                              COND;
-        struct { pth_t tid; }                                     TID;
-        struct { int (*func)(void *); void *arg; pth_time_t tv; } FUNC;
+        struct { int fd; }                                          FD;
+        struct { int *n; int nfd; fd_set *rfds, *wfds, *efds; }     SELECT;
+        struct { sigset_t *sigs; int *sig; }                        SIGS;
+        struct { pth_time_t tv; }                                   TIME;
+        struct { pth_msgport_t mp; }                                MSG;
+        struct { pth_mutex_t *mutex; }                              MUTEX;
+        struct { pth_cond_t *cond; }                                COND;
+        struct { pth_t tid; }                                       TID;
+        struct { pth_event_func_t func; void *arg; pth_time_t tv; } FUNC;
     } ev_args;
 };
 
@@ -196,7 +200,7 @@
         /* custom function event */
         ev->ev_type = PTH_EVENT_FUNC;
         ev->ev_goal = (int)(spec & (PTH_UNTIL_OCCURRED));
-        ev->ev_args.FUNC.func  = va_arg(ap, int (*)(void *));
+        ev->ev_args.FUNC.func  = va_arg(ap, pth_event_func_t);
         ev->ev_args.FUNC.arg   = va_arg(ap, void *);
         ev->ev_args.FUNC.tv    = va_arg(ap, pth_time_t);
     }
@@ -266,9 +270,9 @@
     }
     else if (ev->ev_type & PTH_EVENT_FUNC) {
         /* custom function event */
-        int (**func)(void *) = va_arg(ap, int (**)(void *));
-        void **arg           = va_arg(ap, void **);
-        pth_time_t *tv       = va_arg(ap, pth_time_t *);
+        pth_event_func_t *func = va_arg(ap, pth_event_func_t *);
+        void **arg             = va_arg(ap, void **);
+        pth_time_t *tv         = va_arg(ap, pth_time_t *);
         *func = ev->ev_args.FUNC.func;
         *arg  = ev->ev_args.FUNC.arg;
         *tv   = ev->ev_args.FUNC.tv;

CVSTrac 2.0.1