mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-25 18:14:53 +00:00
dns: Use LWIP_ARRAYSIZE instead of open coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
7e9377a9c7
commit
8c0f620d83
@ -463,7 +463,7 @@ dns_init_local(void)
|
||||
/* Dynamic: copy entries from DNS_LOCAL_HOSTLIST_INIT to list */
|
||||
struct local_hostlist_entry local_hostlist_init[] = DNS_LOCAL_HOSTLIST_INIT;
|
||||
size_t namelen;
|
||||
for (i = 0; i < sizeof(local_hostlist_init) / sizeof(struct local_hostlist_entry); i++) {
|
||||
for (i = 0; i < LWIP_ARRAYSIZE(local_hostlist_init); i++) {
|
||||
struct local_hostlist_entry *init_entry = &local_hostlist_init[i];
|
||||
LWIP_ASSERT("invalid host name (NULL)", init_entry->name != NULL);
|
||||
namelen = strlen(init_entry->name);
|
||||
@ -508,7 +508,7 @@ dns_lookup_local(const char *hostname, ip_addr_t *addr LWIP_DNS_ADDRTYPE_ARG(u8_
|
||||
}
|
||||
#else /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */
|
||||
size_t i;
|
||||
for (i = 0; i < sizeof(local_hostlist_static) / sizeof(struct local_hostlist_entry); i++) {
|
||||
for (i = 0; i < LWIP_ARRAYSIZE(local_hostlist_static); i++) {
|
||||
if ((LWIP_DNS_STRICMP(local_hostlist_static[i].name, hostname) == 0) &&
|
||||
LWIP_DNS_ADDRTYPE_MATCH_IP(dns_addrtype, local_hostlist_static[i].addr)) {
|
||||
if (addr) {
|
||||
|
Loading…
Reference in New Issue
Block a user