Selaa lähdekoodia

core: don't use conditionals in macro arguments

Older gccs (< 3.3) do not like #ifdefs inside macro calls.
Andrei Pelinescu-Onciul 15 vuotta sitten
vanhempi
commit
b7ef157639
2 muutettua tiedostoa jossa 13 lisäystä ja 6 poistoa
  1. 5 3
      io_wait.h
  2. 8 3
      sctp_server.c

+ 5 - 3
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:

+ 8 - 3
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",