[sr-dev] git:master: core: don't use conditionals in macro arguments

Andrei Pelinescu-Onciul andrei at iptel.org
Thu Aug 26 22:01:40 CEST 2010


Module: sip-router
Branch: master
Commit: b7ef15763937e08779fa24d9ad4681be56c2b622
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=b7ef15763937e08779fa24d9ad4681be56c2b622

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu Aug 26 21:46:19 2010 +0200

core: don't use conditionals in macro arguments

Older gccs (< 3.3) do not like #ifdefs inside macro calls.

---

 io_wait.h     |    8 +++++---
 sctp_server.c |   11 ++++++++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/io_wait.h b/io_wait.h
index f3ce324..7220dd5 100644
--- 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:
diff --git a/sctp_server.c b/sctp_server.c
index 81bd3b7..cfd7015 100644
--- a/sctp_server.c
+++ b/sctp_server.c
@@ -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",




More information about the sr-dev mailing list