From 5fcbf04f5b95cccc61b2986a6582fa475e4d9c8b Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 9 Jan 2006 16:50:39 +0000 Subject: Condense winsock includes and defines into one header. git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@428 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/Makefile.am | 2 ++ polyp/iochannel.c | 4 +--- polyp/main.c | 6 ++---- polyp/mainloop.c | 4 +--- polyp/module-protocol-stub.c | 7 +------ polyp/poll.c | 11 +---------- polyp/polyplib-context.c | 7 +------ polyp/pstream.c | 4 +--- polyp/socket-client.c | 11 ++--------- polyp/socket-server.c | 9 ++------- polyp/socket-util.c | 5 +---- polyp/tagstruct.c | 4 +--- polyp/util.c | 9 ++------- polyp/winsock.h | 23 +++++++++++++++++++++++ 14 files changed, 41 insertions(+), 65 deletions(-) create mode 100644 polyp/winsock.h diff --git a/polyp/Makefile.am b/polyp/Makefile.am index 5f57142a..ab7dfe5b 100644 --- a/polyp/Makefile.am +++ b/polyp/Makefile.am @@ -335,6 +335,7 @@ libpolyp_@PA_MAJORMINOR@_la_SOURCES = \ tagstruct.c tagstruct.h \ typeid.c typeid.h \ util.c util.h \ + winsock.h \ xmalloc.c xmalloc.h if HAVE_X11 @@ -476,6 +477,7 @@ libpolypcore_la_SOURCES = \ tokenizer.c tokenizer.h \ typeid.c typeid.h \ util.c util.h \ + winsock.h \ xmalloc.c xmalloc.h libpolypcore_la_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/polyp/iochannel.c b/polyp/iochannel.c index 08a4e362..1a0dbf91 100644 --- a/polyp/iochannel.c +++ b/polyp/iochannel.c @@ -28,9 +28,7 @@ #include #include -#ifdef HAVE_WINSOCK2_H -#include -#endif +#include "winsock.h" #include "iochannel.h" #include "util.h" diff --git a/polyp/main.c b/polyp/main.c index 437f0a41..e481fce1 100644 --- a/polyp/main.c +++ b/polyp/main.c @@ -42,15 +42,13 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif - #ifdef HAVE_LIBWRAP #include #include #endif +#include "winsock.h" + #include "core.h" #include "mainloop.h" #include "module.h" diff --git a/polyp/mainloop.c b/polyp/mainloop.c index 9cfd5397..ada74afc 100644 --- a/polyp/mainloop.c +++ b/polyp/mainloop.c @@ -38,9 +38,7 @@ #include "poll.h" #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif +#include "winsock.h" #include "mainloop.h" #include "util.h" diff --git a/polyp/module-protocol-stub.c b/polyp/module-protocol-stub.c index 8c06a610..141eadd3 100644 --- a/polyp/module-protocol-stub.c +++ b/polyp/module-protocol-stub.c @@ -40,12 +40,7 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif +#include "winsock.h" #include "module.h" #include "socket-server.h" diff --git a/polyp/poll.c b/polyp/poll.c index 7c25f348..cb7e3e7a 100644 --- a/polyp/poll.c +++ b/polyp/poll.c @@ -36,16 +36,7 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include - -#define EBADF WSAEBADF -#define ESHUTDOWN WSAESHUTDOWN -#define ECONNRESET WSAECONNRESET -#define ECONNABORTED WSAECONNABORTED -#define ENETRESET WSAENETRESET - -#endif /* HAVE_WINSOCK2_H */ +#include "winsock.h" #ifndef HAVE_SYS_POLL_H diff --git a/polyp/polyplib-context.c b/polyp/polyplib-context.c index da91995b..f97d9b82 100644 --- a/polyp/polyplib-context.c +++ b/polyp/polyplib-context.c @@ -45,12 +45,7 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#define ETIMEDOUT WSAETIMEDOUT -#define ECONNREFUSED WSAECONNREFUSED -#define EHOSTUNREACH WSAEHOSTUNREACH -#endif +#include "winsock.h" #include "polyplib-internal.h" #include "polyplib-context.h" diff --git a/polyp/pstream.c b/polyp/pstream.c index 607b0c1a..6f983289 100644 --- a/polyp/pstream.c +++ b/polyp/pstream.c @@ -32,9 +32,7 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif +#include "winsock.h" #include "pstream.h" #include "queue.h" diff --git a/polyp/socket-client.c b/polyp/socket-client.c index 6d8cb2ab..51134b84 100644 --- a/polyp/socket-client.c +++ b/polyp/socket-client.c @@ -48,19 +48,12 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#define EINPROGRESS WSAEINPROGRESS -#define ETIMEDOUT WSAETIMEDOUT -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif - #ifdef HAVE_LIBASYNCNS #include #endif +#include "winsock.h" + #include "socket-client.h" #include "socket-util.h" #include "util.h" diff --git a/polyp/socket-server.c b/polyp/socket-server.c index c27979da..18122f33 100644 --- a/polyp/socket-server.c +++ b/polyp/socket-server.c @@ -48,17 +48,12 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif - #ifdef HAVE_LIBWRAP #include #endif +#include "winsock.h" + #include "socket-server.h" #include "socket-util.h" #include "xmalloc.h" diff --git a/polyp/socket-util.c b/polyp/socket-util.c index 699b28c2..381502b5 100644 --- a/polyp/socket-util.c +++ b/polyp/socket-util.c @@ -57,10 +57,7 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#define ETIMEDOUT WSAETIMEDOUT -#endif +#include "winsock.h" #include "socket-util.h" #include "util.h" diff --git a/polyp/tagstruct.c b/polyp/tagstruct.c index ff444e36..1e44f8ef 100644 --- a/polyp/tagstruct.c +++ b/polyp/tagstruct.c @@ -33,9 +33,7 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif +#include "winsock.h" #include "tagstruct.h" #include "xmalloc.h" diff --git a/polyp/util.c b/polyp/util.c index ff27430a..f1f4b2c5 100644 --- a/polyp/util.c +++ b/polyp/util.c @@ -59,13 +59,6 @@ #include #endif -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_WS2TCPIP_H -#include -#endif - #include #ifdef HAVE_PWD_H @@ -75,6 +68,8 @@ #include #endif +#include "winsock.h" + #include "util.h" #include "xmalloc.h" #include "log.h" diff --git a/polyp/winsock.h b/polyp/winsock.h new file mode 100644 index 00000000..60fac87d --- /dev/null +++ b/polyp/winsock.h @@ -0,0 +1,23 @@ +#ifndef foowinsockhfoo +#define foowinsockhfoo + +#ifdef HAVE_WINSOCK2_H +#include + +#define EBADF WSAEBADF +#define ESHUTDOWN WSAESHUTDOWN +#define ECONNRESET WSAECONNRESET +#define ECONNABORTED WSAECONNABORTED +#define ENETRESET WSAENETRESET +#define EINPROGRESS WSAEINPROGRESS +#define ETIMEDOUT WSAETIMEDOUT +#define ECONNREFUSED WSAECONNREFUSED +#define EHOSTUNREACH WSAEHOSTUNREACH + +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +#endif -- cgit