Fix compiler warning: variable was set but never used
Simplify preprocessor symbol checking
This commit is contained in:
parent
17a2c32ca9
commit
46de140aca
@ -153,17 +153,16 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
|||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
char sbuf[NI_MAXSERV];
|
char sbuf[NI_MAXSERV];
|
||||||
char *sbufptr = NULL;
|
char *sbufptr = NULL;
|
||||||
int error;
|
|
||||||
|
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = PF_INET;
|
hints.ai_family = PF_INET;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
if (port) {
|
if(port) {
|
||||||
snprintf(sbuf, sizeof(sbuf), "%d", port);
|
snprintf(sbuf, sizeof(sbuf), "%d", port);
|
||||||
sbufptr = sbuf;
|
sbufptr = sbuf;
|
||||||
}
|
}
|
||||||
hints.ai_flags = AI_CANONNAME;
|
hints.ai_flags = AI_CANONNAME;
|
||||||
error = Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai);
|
(void)Curl_getaddrinfo_ex(hostname, sbufptr, &hints, &ai);
|
||||||
|
|
||||||
#elif defined(HAVE_GETHOSTBYNAME_R)
|
#elif defined(HAVE_GETHOSTBYNAME_R)
|
||||||
/*
|
/*
|
||||||
@ -183,7 +182,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
|||||||
* platforms.
|
* platforms.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_5
|
#if defined(HAVE_GETHOSTBYNAME_R_5)
|
||||||
/* Solaris, IRIX and more */
|
/* Solaris, IRIX and more */
|
||||||
h = gethostbyname_r(hostname,
|
h = gethostbyname_r(hostname,
|
||||||
(struct hostent *)buf,
|
(struct hostent *)buf,
|
||||||
@ -201,8 +200,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* HAVE_GETHOSTBYNAME_R_5 */
|
#elif defined(HAVE_GETHOSTBYNAME_R_6)
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_6
|
|
||||||
/* Linux */
|
/* Linux */
|
||||||
|
|
||||||
(void)gethostbyname_r(hostname,
|
(void)gethostbyname_r(hostname,
|
||||||
@ -243,8 +241,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if(!h) /* failure */
|
if(!h) /* failure */
|
||||||
#endif/* HAVE_GETHOSTBYNAME_R_6 */
|
#elif defined(HAVE_GETHOSTBYNAME_R_3)
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_3
|
|
||||||
/* AIX, Digital Unix/Tru64, HPUX 10, more? */
|
/* AIX, Digital Unix/Tru64, HPUX 10, more? */
|
||||||
|
|
||||||
/* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of
|
/* For AIX 4.3 or later, we don't use gethostbyname_r() at all, because of
|
||||||
@ -296,23 +293,20 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char *hostname,
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* HAVE_GETHOSTBYNAME_R_3 */
|
#endif /* HAVE_...BYNAME_R_5 || HAVE_...BYNAME_R_6 || HAVE_...BYNAME_R_3 */
|
||||||
{
|
{
|
||||||
h = NULL; /* set return code to NULL */
|
h = NULL; /* set return code to NULL */
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
#else /* HAVE_GETHOSTBYNAME_R */
|
#else /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */
|
||||||
/*
|
/*
|
||||||
* Here is code for platforms that don't have gethostbyname_r() or for
|
* Here is code for platforms that don't have a thread safe
|
||||||
* which the gethostbyname() is the preferred() function.
|
* getaddrinfo() nor gethostbyname_r() function or for which
|
||||||
|
* gethostbyname() is the preferred one.
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
|
h = gethostbyname((void*)hostname);
|
||||||
h = gethostbyname((char*)hostname);
|
#endif /* HAVE_GETADDRINFO_THREADSAFE || HAVE_GETHOSTBYNAME_R */
|
||||||
#else
|
|
||||||
h = gethostbyname(hostname);
|
|
||||||
#endif
|
|
||||||
#endif /*HAVE_GETHOSTBYNAME_R */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(h) {
|
if(h) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user