# HG changeset patch
# User William Pitcock <nenolod@dereferenced.org>
# Date 1358151163 21600
# Node ID 2b30862e669cff854bd309f02f0dc8c0e109c66e
# Parent  6f401411763f28993f25ffcccf9a45738e768b43
- Pull in poll(2) stuff before any other ircd include files. (#4155)
  This allows us to successfully build on systems where pulling in poll.h
  pollutes the code with a broken form of ctypes.h due to a few reasons, not
  limited to, but including, usage of non-namespaced macros which clash with
  our own.

diff -r 6f401411763f -r 2b30862e669c src/s_bsd.c
--- a/src/s_bsd.c	Fri Jan 11 19:05:36 2013 +0100
+++ b/src/s_bsd.c	Mon Jan 14 02:12:43 2013 -0600
@@ -43,6 +43,21 @@
 #include <WinSock2.h>
 #endif
 
+#include "setup.h"
+#include "config.h"
+
+#ifdef USE_POLL
+# ifndef _WIN32
+#  include <poll.h>
+#  ifndef POLLRDHUP
+#   define POLLRDHUP 0
+#  endif
+# else
+#  define poll WSAPoll
+#  define POLLRDHUP POLLHUP
+# endif
+#endif
+
 #include "struct.h"
 #include "common.h"
 #include "sys.h"
@@ -74,16 +89,6 @@
 #endif
 
 #ifdef USE_POLL
-# ifndef _WIN32
-#  include <sys/poll.h>
-#  include <poll.h>
-#  ifndef POLLRDHUP
-#   define POLLRDHUP 0
-#  endif
-# else
-#  define poll WSAPoll
-#  define POLLRDHUP POLLHUP
-# endif
 
 static struct pollfd pollfds[MAXCONNECTIONS], dummy_pollfd;
 static int pollfd_count = 0;
diff -r 6f401411763f -r 2b30862e669c src/url.c
--- a/src/url.c	Fri Jan 11 19:05:36 2013 +0100
+++ b/src/url.c	Mon Jan 14 02:12:43 2013 -0600
@@ -17,18 +17,11 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <string.h>
-#include <stdio.h>
-#include <struct.h>
-#include "proto.h"
-#include "h.h"
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <curl/curl.h>
+#include "setup.h"
+#include "config.h"
 
 #ifdef USE_POLL
 # ifndef _WIN32
-#  include <sys/poll.h>
 #  include <poll.h>
 #  ifndef POLLRDHUP
 #   define POLLRDHUP 0
@@ -39,6 +32,16 @@
 # endif
 #endif
 
+#include <string.h>
+#include <stdio.h>
+#include <struct.h>
+
+#include "proto.h"
+#include "h.h"
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <curl/curl.h>
+
 #ifdef USE_SSL
 extern char *SSLKeyPasswd;
 #endif
