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);
}
-#if defined(HAVE_GETADDRINFO)
+#ifdef HAVE_GETADDRINFO
/*
* getaddrinfo_thread() resolves a name and then exits.
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 */
/*
return 0;
}
-#if !defined(HAVE_GETADDRINFO)
+#ifndef HAVE_GETADDRINFO
/*
* Curl_getaddrinfo() - for platforms without getaddrinfo
*/
return Curl_ipv4_resolve_r(hostname, port);
}
-#else /* HAVE_GETADDRINFO */
+#else /* !HAVE_GETADDRINFO */
/*
* Curl_getaddrinfo() - for getaddrinfo
*waitp = 0; /* default to synchronous response */
-#if !defined(CURLRES_IPV4)
+#ifndef CURLRES_IPV4
/*
* Check if a limited name resolve has been requested.
*/
return res;
}
-#endif /* HAVE_GETADDRINFO */
+#endif /* !HAVE_GETADDRINFO */
#endif /* CURLRES_THREADED */