Skip to content

Commit e55b2ab

Browse files
author
Holden
committed
Start enforcing macro value limits and make some doc more succinct
1 parent a0cab85 commit e55b2ab

File tree

4 files changed

+568
-614
lines changed

4 files changed

+568
-614
lines changed

source/FreeRTOS_DNS.c

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,6 @@
491491
}
492492
#endif /* if ( ipconfigDNS_USE_CALLBACKS == 0 ) */
493493

494-
#if ( ipconfigINCLUDE_FULL_INET_ADDR == 1 )
495-
496494
/**
497495
* @brief See if pcHostName contains a valid IPv4 or IPv6 IP-address.
498496
* @param[in] pcHostName: The name to be looked up
@@ -501,52 +499,51 @@
501499
* be stored.
502500
* @return Either 0 or an IP=address.
503501
*/
504-
static uint32_t prvPrepare_ReadIPAddress( const char * pcHostName,
505-
BaseType_t xFamily,
506-
struct freertos_addrinfo ** ppxAddressInfo )
507-
{
508-
uint32_t ulIPAddress = 0U;
502+
static uint32_t prvPrepare_ReadIPAddress( const char * pcHostName,
503+
BaseType_t xFamily,
504+
struct freertos_addrinfo ** ppxAddressInfo )
505+
{
506+
uint32_t ulIPAddress = 0U;
509507

510-
( void ) xFamily;
508+
( void ) xFamily;
511509

512-
/* Check if the hostname given is actually an IP-address. */
513-
#if ( ipconfigUSE_IPv6 != 0 )
514-
if( xFamily == FREERTOS_AF_INET6 )
515-
{
516-
IPv6_Address_t xAddress_IPv6;
517-
BaseType_t xResult;
510+
/* Check if the hostname given is actually an IP-address. */
511+
#if ( ipconfigUSE_IPv6 != 0 )
512+
if( xFamily == FREERTOS_AF_INET6 )
513+
{
514+
IPv6_Address_t xAddress_IPv6;
515+
BaseType_t xResult;
518516

519-
/* ulIPAddress does not represent an IPv4 address here. It becomes non-zero when the look-up succeeds. */
520-
xResult = FreeRTOS_inet_pton6( pcHostName, xAddress_IPv6.ucBytes );
517+
/* ulIPAddress does not represent an IPv4 address here. It becomes non-zero when the look-up succeeds. */
518+
xResult = FreeRTOS_inet_pton6( pcHostName, xAddress_IPv6.ucBytes );
521519

522-
if( xResult == 1 )
523-
{
524-
/* This function returns either a valid IPv4 address, or
525-
* in case of an IPv6 lookup, it will return a non-zero */
526-
ulIPAddress = 1U;
520+
if( xResult == 1 )
521+
{
522+
/* This function returns either a valid IPv4 address, or
523+
* in case of an IPv6 lookup, it will return a non-zero */
524+
ulIPAddress = 1U;
527525

528-
if( ppxAddressInfo != NULL )
529-
{
530-
*( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET6, xAddress_IPv6.ucBytes );
531-
}
526+
if( ppxAddressInfo != NULL )
527+
{
528+
*( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET6, xAddress_IPv6.ucBytes );
532529
}
533530
}
534-
else
535-
#endif /* ipconfigUSE_IPv6 */
536-
{
537-
ulIPAddress = FreeRTOS_inet_addr( pcHostName );
531+
}
532+
else
533+
#endif /* ipconfigUSE_IPv6 */
534+
{
535+
ulIPAddress = FreeRTOS_inet_addr( pcHostName );
538536

539-
if( ( ulIPAddress != 0U ) && ( ppxAddressInfo != NULL ) )
540-
{
541-
const uint8_t * ucBytes = ( uint8_t * ) &( ulIPAddress );
537+
if( ( ulIPAddress != 0U ) && ( ppxAddressInfo != NULL ) )
538+
{
539+
const uint8_t * ucBytes = ( uint8_t * ) &( ulIPAddress );
542540

543-
*( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET4, ucBytes );
544-
}
541+
*( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET4, ucBytes );
545542
}
546-
547-
return ulIPAddress;
548543
}
549-
#endif /* ( ipconfigINCLUDE_FULL_INET_ADDR == 1 ) */
544+
545+
return ulIPAddress;
546+
}
550547
/*-----------------------------------------------------------*/
551548

552549
#if ( ipconfigDNS_USE_CALLBACKS == 1 )
@@ -621,11 +618,7 @@
621618
{
622619
/* If the supplied hostname is an IP address, put it in ppxAddressInfo
623620
* and return. */
624-
#if ( ipconfigINCLUDE_FULL_INET_ADDR == 1 )
625-
{
626-
ulIPAddress = prvPrepare_ReadIPAddress( pcHostName, xFamily, ppxAddressInfo );
627-
}
628-
#endif /* ipconfigINCLUDE_FULL_INET_ADDR == 1 */
621+
ulIPAddress = prvPrepare_ReadIPAddress( pcHostName, xFamily, ppxAddressInfo );
629622

630623
/* If a DNS cache is used then check the cache before issuing another DNS
631624
* request. */

0 commit comments

Comments
 (0)