1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

used allways #ifdef / #ifndef;

moved gethostbyname_thread() to #else case to avoid 'not used' compiler warning.
This commit is contained in:
Gunter Knauf 2010-02-13 18:39:47 +00:00
parent ac04add596
commit 68b73bcfba

View File

@ -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 */