mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 21:32:46 +00:00
Apply patch #8854: dns: Simplify #ifdef guard around dns_gethostbyname_addrtype from Axel Lin
+ Minor compile fix from me Patch makes the code a tiny bit less lightweight (add a parameter in dns_gethostbyname which is then not used in dns_gethostbyname_addrtype) but it makes the code more readable.
This commit is contained in:
parent
a93ae2558f
commit
70487a43d4
@ -1404,7 +1404,6 @@ err_t
|
||||
dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found,
|
||||
void *callback_arg)
|
||||
{
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
return dns_gethostbyname_addrtype(hostname, addr, found, callback_arg, LWIP_DNS_ADDRTYPE_DEFAULT);
|
||||
}
|
||||
|
||||
@ -1418,7 +1417,6 @@ err_t
|
||||
dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found,
|
||||
void *callback_arg, u8_t dns_addrtype)
|
||||
{
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
size_t hostnamelen;
|
||||
/* not initialized or no valid server yet, or invalid addr pointer
|
||||
* or invalid hostname or invalid hostname length */
|
||||
@ -1472,20 +1470,12 @@ dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_call
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
#else /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
LWIP_UNUSED_ARG(dns_addrtype);
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
|
||||
/* queue query with specified callback */
|
||||
return dns_enqueue(hostname, hostnamelen, found, callback_arg LWIP_DNS_ADDRTYPE_ARG(dns_addrtype));
|
||||
}
|
||||
|
||||
#if !LWIP_IPV4 || !LWIP_IPV6
|
||||
err_t
|
||||
dns_gethostbyname_addrtype(const char *hostname, ip_addr_t *addr, dns_found_callback found,
|
||||
void *callback_arg, u8_t dns_addrtype)
|
||||
{
|
||||
LWIP_UNUSED_ARG(dns_addrtype);
|
||||
return dns_gethostbyname(hostname, addr, found, callback_arg);
|
||||
}
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
|
||||
#endif /* LWIP_DNS */
|
||||
|
Loading…
x
Reference in New Issue
Block a user