core: don't use conditionals in macro arguments
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Thu, 26 Aug 2010 19:46:19 +0000 (21:46 +0200)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Thu, 26 Aug 2010 20:00:02 +0000 (22:00 +0200)
Older gccs (< 3.3) do not like #ifdefs inside macro calls.

io_wait.h
sctp_server.c

index f3ce324..7220dd5 100644 (file)
--- a/io_wait.h
+++ b/io_wait.h
@@ -812,12 +812,14 @@ inline static int io_watch_chg(io_wait_h* h, int fd, short events, int idx )
        del_events=e->events & ~events;
        switch(h->poll_method){
                case POLL_POLL:
-                       fd_array_chg(events
 #ifdef POLLRDHUP
+                       fd_array_chg(events |
                                                        /* listen to POLLRDHUP by default (if POLLIN) */
-                                                       | (((int)!(events & POLLIN) - 1) & POLLRDHUP)
-#endif /* POLLRDHUP */
+                                                       (((int)!(events & POLLIN) - 1) & POLLRDHUP)
                                                );
+#else /* POLLRDHUP */
+                       fd_array_chg(events);
+#endif /* POLLRDHUP */
                        break;
 #ifdef HAVE_SELECT
                case POLL_SELECT:
index 81bd3b7..cfd7015 100644 (file)
@@ -2475,12 +2475,17 @@ int sctp_rcv_loop()
                
                /* get ancillary data */
                for (cmsg=CMSG_FIRSTHDR(&msg); cmsg; cmsg=CMSG_NXTHDR(&msg, cmsg)){
+#ifdef SCTP_EXT
                        if (likely((cmsg->cmsg_level==IPPROTO_SCTP) &&
                                                ((cmsg->cmsg_type==SCTP_SNDRCV)
-#ifdef SCTP_EXT
                                                 || (cmsg->cmsg_type==SCTP_EXTRCV)
-#endif
-                                               ) && (cmsg->cmsg_len>=CMSG_LEN(sizeof(*sinfo)))) ){
+                                               ) && (cmsg->cmsg_len>=CMSG_LEN(sizeof(*sinfo)))) )
+#else  /* !SCTP_EXT -- same as above but w/o SCTP_EXTRCV */
+                       if (likely((cmsg->cmsg_level==IPPROTO_SCTP) &&
+                                               ((cmsg->cmsg_type==SCTP_SNDRCV)
+                                               ) && (cmsg->cmsg_len>=CMSG_LEN(sizeof(*sinfo)))) )
+#endif /*SCTP_EXT */
+                       {
                                sinfo=(struct sctp_sndrcvinfo*)CMSG_DATA(cmsg);
                                DBG("sctp recv: message from %s:%d stream %d  ppid %x"
                                                " flags %x%s tsn %u" " cumtsn %u assoc_id %d\n",