Skip to content

Commit 9a241ef

Browse files
author
Holden
committed
Start enforcing macro value limits and make some doc more succinct
1 parent e816a34 commit 9a241ef

File tree

3 files changed

+39
-51
lines changed

3 files changed

+39
-51
lines changed

source/FreeRTOS_DNS.c

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

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

511-
( void ) xFamily;
509+
( void ) xFamily;
512510

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

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

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

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

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

544-
*( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET4, ucBytes );
545-
}
542+
*( ppxAddressInfo ) = pxNew_AddrInfo( pcHostName, FREERTOS_AF_INET4, ucBytes );
546543
}
547-
548-
return ulIPAddress;
549544
}
550-
#endif /* ( ipconfigINCLUDE_FULL_INET_ADDR == 1 ) */
545+
546+
return ulIPAddress;
547+
}
551548
/*-----------------------------------------------------------*/
552549

553550
#if ( ipconfigDNS_USE_CALLBACKS == 1 )
@@ -622,11 +619,7 @@
622619
{
623620
/* If the supplied hostname is an IP address, put it in ppxAddressInfo
624621
* and return. */
625-
#if ( ipconfigINCLUDE_FULL_INET_ADDR == 1 )
626-
{
627-
ulIPAddress = prvPrepare_ReadIPAddress( pcHostName, xFamily, ppxAddressInfo );
628-
}
629-
#endif /* ipconfigINCLUDE_FULL_INET_ADDR == 1 */
622+
ulIPAddress = prvPrepare_ReadIPAddress( pcHostName, xFamily, ppxAddressInfo );
630623

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

source/include/FreeRTOSIPDeprecatedDefinitions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
#error ipconfigHAS_INLINE_FUNCTIONS is not used
7070
#endif
7171

72+
#ifdef ipconfigINCLUDE_FULL_INET_ADDR
73+
#error ipconfigINCLUDE_FULL_INET_ADDR is not used
74+
#endif
75+
7276
#ifdef ipconfigMAX_SEND_BLOCK_TIME_TICKS
7377
#error Now called: ipconfigUDP_MAX_SEND_BLOCK_TIME_TICKS
7478
#endif

source/include/FreeRTOS_DNS_Globals.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@
9898
#define dnsNBNS_QUERY_RESPONSE_FLAGS ( 0x8500U )
9999
#endif /* ( ipconfigUSE_NBNS != 0 ) */
100100

101-
102-
#ifndef _lint
103-
#if ( ipconfigUSE_DNS_CACHE == 0 )
104-
#if ( ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY != 1 )
105-
#error When DNS caching is disabled, please make ipconfigDNS_CACHE_ADDRESSES_PER_ENTRY equal to 1.
106-
#endif
107-
#endif
108-
#endif
109-
110101
/** @brief Define the ASCII value of '.' (Period/Full-stop). */
111102
#define ASCII_BASELINE_DOT 46U
112103

0 commit comments

Comments
 (0)