aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hostthre.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/lib/hostthre.c b/lib/hostthre.c
index 121a60869..33675b485 100644
--- a/lib/hostthre.c
+++ b/lib/hostthre.c
@@ -181,28 +181,6 @@ int init_thread_sync_data(struct thread_sync_data * tsd,
return 0;
}
-/*
- * gethostbyname_thread() resolves a name and then exits.
- */
-static unsigned int CURL_STDCALL gethostbyname_thread (void *arg)
-{
- struct thread_sync_data *tsd = (struct thread_sync_data *)arg;
-
- tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port);
-
- if (!tsd->res) {
- tsd->sock_error = SOCKERRNO;
- if (tsd->sock_error == 0)
- tsd->sock_error = ENOMEM;
- }
-
- Curl_mutex_acquire(tsd->mtx);
- tsd->done = 1;
- Curl_mutex_release(tsd->mtx);
-
- return 0;
-}
-
static int getaddrinfo_complete(struct connectdata *conn)
{
struct thread_sync_data *tsd = conn_thread_sync_data(conn);
@@ -218,7 +196,7 @@ static int getaddrinfo_complete(struct connectdata *conn)
}
-#if defined(HAVE_GETADDRINFO)
+#ifdef HAVE_GETADDRINFO
/*
* getaddrinfo_thread() resolves a name and then exits.
@@ -249,6 +227,30 @@ static unsigned int CURL_STDCALL getaddrinfo_thread (void *arg)
return 0;
}
+#else /* HAVE_GETADDRINFO */
+
+/*
+ * gethostbyname_thread() resolves a name and then exits.
+ */
+static unsigned int CURL_STDCALL gethostbyname_thread (void *arg)
+{
+ struct thread_sync_data *tsd = (struct thread_sync_data *)arg;
+
+ tsd->res = Curl_ipv4_resolve_r(tsd->hostname, tsd->port);
+
+ if (!tsd->res) {
+ tsd->sock_error = SOCKERRNO;
+ if (tsd->sock_error == 0)
+ tsd->sock_error = ENOMEM;
+ }
+
+ Curl_mutex_acquire(tsd->mtx);
+ tsd->done = 1;
+ Curl_mutex_release(tsd->mtx);
+
+ return 0;
+}
+
#endif /* HAVE_GETADDRINFO */
/*
@@ -474,7 +476,7 @@ int Curl_resolv_getsock(struct connectdata *conn,
return 0;
}
-#if !defined(HAVE_GETADDRINFO)
+#ifndef HAVE_GETADDRINFO
/*
* Curl_getaddrinfo() - for platforms without getaddrinfo
*/
@@ -503,7 +505,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
return Curl_ipv4_resolve_r(hostname, port);
}
-#else /* HAVE_GETADDRINFO */
+#else /* !HAVE_GETADDRINFO */
/*
* Curl_getaddrinfo() - for getaddrinfo
@@ -522,7 +524,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
*waitp = 0; /* default to synchronous response */
-#if !defined(CURLRES_IPV4)
+#ifndef CURLRES_IPV4
/*
* Check if a limited name resolve has been requested.
*/
@@ -584,6 +586,6 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
return res;
}
-#endif /* HAVE_GETADDRINFO */
+#endif /* !HAVE_GETADDRINFO */
#endif /* CURLRES_THREADED */