diff --git a/lib/hostip.h b/lib/hostip.h index e987f301e..85425b6ce 100644 --- a/lib/hostip.h +++ b/lib/hostip.h @@ -37,38 +37,13 @@ #endif /* - * Setup comfortable CURLRES_* defines to use in the host*.c sources. + * Comfortable CURLRES_* definitions are included from setup.h */ #ifdef USE_ARES #include #endif -#ifdef USE_ARES -#define CURLRES_ASYNCH -#define CURLRES_ARES -#endif - -#ifdef USE_THREADING_GETHOSTBYNAME -#define CURLRES_ASYNCH -#define CURLRES_THREADED -#endif - -#ifdef USE_THREADING_GETADDRINFO -#define CURLRES_ASYNCH -#define CURLRES_THREADED -#endif - -#ifdef ENABLE_IPV6 -#define CURLRES_IPV6 -#else -#define CURLRES_IPV4 -#endif - -#ifndef CURLRES_ASYNCH -#define CURLRES_SYNCH -#endif - /* Allocate enough memory to hold the full name information structs and * everything. OSF1 is known to require at least 8872 bytes. The buffer * required for storing all possible aliases and IP numbers is according to diff --git a/lib/setup.h b/lib/setup.h index a8549a7d8..980a91699 100644 --- a/lib/setup.h +++ b/lib/setup.h @@ -407,6 +407,27 @@ #endif /* WIN32 */ +/* + * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN + * defined in ws2tcpip.h as well as to provide IPv6 support. + */ + +#if defined(_MSC_VER) && !defined(__POCC__) +# if !defined(HAVE_WS2TCPIP_H) || \ + ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN)) +# undef HAVE_GETADDRINFO_THREADSAFE +# undef HAVE_FREEADDRINFO +# undef HAVE_GETADDRINFO +# undef HAVE_GETNAMEINFO +# undef ENABLE_IPV6 +# endif +#endif + +/* ---------------------------------------------------------------- */ +/* resolver specialty compile-time defines */ +/* CURLRES_* defines to use in the host*.c sources */ +/* ---------------------------------------------------------------- */ + #if defined(WIN32) && !defined(__CYGWIN__) && !defined(USE_ARES) && \ !defined(__LCC__) /* lcc-win32 doesn't have _beginthreadex() */ #ifdef ENABLE_IPV6 @@ -424,6 +445,33 @@ #define CURL_NO__BEGINTHREADEX #endif +#ifdef USE_ARES +# define CURLRES_ASYNCH +# define CURLRES_ARES +#endif + +#ifdef USE_THREADING_GETHOSTBYNAME +# define CURLRES_ASYNCH +# define CURLRES_THREADED +#endif + +#ifdef USE_THREADING_GETADDRINFO +# define CURLRES_ASYNCH +# define CURLRES_THREADED +#endif + +#ifdef ENABLE_IPV6 +# define CURLRES_IPV6 +#else +# define CURLRES_IPV4 +#endif + +#ifndef CURLRES_ASYNCH +# define CURLRES_SYNCH +#endif + +/* ---------------------------------------------------------------- */ + /* * When using WINSOCK, TELNET protocol requires WINSOCK2 API. */ @@ -444,20 +492,6 @@ # endif #endif -/* - * msvc 6.0 requires PSDK in order to have INET6_ADDRSTRLEN - * defined in ws2tcpip.h as well as to provide IPv6 support. - */ - -#if defined(_MSC_VER) && !defined(__POCC__) -# if !defined(HAVE_WS2TCPIP_H) || ((_MSC_VER < 1300) && !defined(INET6_ADDRSTRLEN)) -# undef HAVE_FREEADDRINFO -# undef HAVE_GETADDRINFO -# undef HAVE_GETNAMEINFO -# undef ENABLE_IPV6 -# endif -#endif - /* * Intentionally fail to build when using msvc 6.0 without PSDK installed. * The brave of heart can circumvent this, defining ALLOW_MSVC6_WITHOUT_PSDK diff --git a/lib/url.c b/lib/url.c index f3ac14d5c..927e16887 100644 --- a/lib/url.c +++ b/lib/url.c @@ -5044,8 +5044,7 @@ CURLcode Curl_connect(struct SessionHandle *data, CURLcode Curl_async_resolved(struct connectdata *conn, bool *protocol_done) { -#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \ - defined(USE_THREADING_GETADDRINFO) +#ifdef CURLRES_ASYNCH CURLcode code; if(conn->async.dns) { diff --git a/lib/urldata.h b/lib/urldata.h index 8e3f612ce..f02bfc43d 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -436,8 +436,7 @@ typedef enum { } zlibInitState; #endif -#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \ - defined(USE_THREADING_GETADDRINFO) +#ifdef CURLRES_ASYNCH struct Curl_async { char *hostname; int port; @@ -813,8 +812,7 @@ struct connectdata { char syserr_buf [256]; /* buffer for Curl_strerror() */ -#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \ - defined(USE_THREADING_GETADDRINFO) +#ifdef CURLRES_ASYNCH /* data used for the asynch name resolve callback */ struct Curl_async async; #endif