From 15fac7743c73acfb04ee5857f3756741bbba78a2 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 30 Mar 2020 20:49:28 +0800 Subject: [PATCH] libc/netdb: Fix nxstyle issue Signed-off-by: Xiang Xiao --- include/netdb.h | 15 ++++--- libs/libc/netdb/lib_dns.h | 10 +++-- libs/libc/netdb/lib_dnsbind.c | 3 +- libs/libc/netdb/lib_dnscache.c | 12 ++--- libs/libc/netdb/lib_dnsforeach.c | 1 + libs/libc/netdb/lib_dnsinit.c | 67 ++++++++++++++-------------- libs/libc/netdb/lib_dnsnotify.c | 11 ++--- libs/libc/netdb/lib_dnsquery.c | 64 +++++++++----------------- libs/libc/netdb/lib_gethostbyaddr.c | 3 +- libs/libc/netdb/lib_gethostbyaddrr.c | 2 +- libs/libc/netdb/lib_gethostbynamer.c | 32 ++++++------- libs/libc/netdb/lib_getnameinfo.c | 4 +- libs/libc/netdb/lib_getservbyname.c | 3 +- libs/libc/netdb/lib_netdb.c | 1 - libs/libc/netdb/lib_parsehostfile.c | 20 ++++----- 15 files changed, 121 insertions(+), 127 deletions(-) diff --git a/include/netdb.h b/include/netdb.h index 8fc99a4af9f..6bb15ba4a55 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -4,7 +4,8 @@ * Copyright (C) 2015, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * - * Reference: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html + * Reference: + * http://pubs.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -180,8 +181,9 @@ struct hostent { FAR char *h_name; /* Official name of the host. */ - FAR char **h_aliases; /* A pointer to an array of pointers to alternative - * host names, terminated by a null pointer. */ + FAR char **h_aliases; /* A pointer to an array of pointers to the + * alternative host names, terminated by a + * null pointer. */ int h_addrtype; /* Address type. */ int h_length; /* The length, in bytes, of the address. */ FAR char **h_addr_list; /* A pointer to an array of pointers to network @@ -193,10 +195,11 @@ struct hostent struct netent { - FAR char *n_name; /* Official, fully-qualified (including the domain) + FAR char *n_name; /* Official, fully-qualified(including the domain) * name of the host. */ - FAR char **n_aliases; /* A pointer to an array of pointers to alternative - * network names, terminated by a null pointer. */ + FAR char **n_aliases; /* A pointer to an array of pointers to the + * alternative network names, terminated by a + * null pointer. */ int n_addrtype; /* The address type of the network. */ uint32_t n_net; /* The network number, in host byte order. */ }; diff --git a/libs/libc/netdb/lib_dns.h b/libs/libc/netdb/lib_dns.h index f58cc564202..6a2b2fc4f73 100644 --- a/libs/libc/netdb/lib_dns.h +++ b/libs/libc/netdb/lib_dns.h @@ -2,7 +2,8 @@ * libs/libc/netdb/lib_dns.h * DNS resolver code header file. * - * Copyright (C) 2007-2009, 2011-2012, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2014 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Inspired by/based on uIP logic by Adam Dunkels: @@ -56,7 +57,8 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* DNS client configuration **************************************************/ + +/* DNS client configuration *************************************************/ #ifndef CONFIG_NETDB_DNSCLIENT_ENTRIES # define CONFIG_NETDB_DNSCLIENT_ENTRIES 4 @@ -85,6 +87,7 @@ /**************************************************************************** * Public Types ****************************************************************************/ + /* This describes either an IPv4 or IPv6 address. It is essentially a named * alternative to sockaddr_storage. */ @@ -248,7 +251,8 @@ int dns_find_answer(FAR const char *hostname, FAR union dns_addr_u *addr, * Name: dns_notify_nameserver ****************************************************************************/ -void dns_notify_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen); +void dns_notify_nameserver(FAR const struct sockaddr *addr, + socklen_t addrlen); #undef EXTERN #if defined(__cplusplus) diff --git a/libs/libc/netdb/lib_dnsbind.c b/libs/libc/netdb/lib_dnsbind.c index 8d941affceb..a1b7d04c16b 100644 --- a/libs/libc/netdb/lib_dnsbind.c +++ b/libs/libc/netdb/lib_dnsbind.c @@ -1,7 +1,8 @@ /**************************************************************************** * libs/libc/netdb/lib_dnsbind.c * - * Copyright (C) 2007, 2009, 2012, 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2012, 2014-2016 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/libs/libc/netdb/lib_dnscache.c b/libs/libc/netdb/lib_dnscache.c index e11ceb3b8e7..6809ae30cc1 100644 --- a/libs/libc/netdb/lib_dnscache.c +++ b/libs/libc/netdb/lib_dnscache.c @@ -1,7 +1,8 @@ /**************************************************************************** * libs/libc/netdb/lib_dnscache.c * - * Copyright (C) 2007, 2009, 2012, 2014-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2012, 2014-2016 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -79,7 +80,7 @@ struct dns_cache_s #endif char name[CONFIG_NETDB_DNSCLIENT_NAMESIZE]; uint8_t naddr; /* How many addresses per name */ - union dns_addr_u addr[CONFIG_NETDB_MAX_IPADDR]; /* Resolved address */ + union dns_addr_u addr[CONFIG_NETDB_MAX_IPADDR]; }; /**************************************************************************** @@ -255,13 +256,14 @@ int dns_find_answer(FAR const char *hostname, FAR union dns_addr_u *addr, else #endif { - /* The entry has not expired, check for a name match. Notice that - * because the names are truncated to CONFIG_NETDB_DNSCLIENT_NAMESIZE, + /* The entry has not expired, check for a name match. Because + * the names are truncated to CONFIG_NETDB_DNSCLIENT_NAMESIZE, * this has the possibility of aliasing two names and returning * the wrong entry from the cache. */ - if (strncmp(hostname, entry->name, CONFIG_NETDB_DNSCLIENT_NAMESIZE) == 0) + if (strncmp(hostname, entry->name, + CONFIG_NETDB_DNSCLIENT_NAMESIZE) == 0) { /* We have a match. Return the resolved host address */ diff --git a/libs/libc/netdb/lib_dnsforeach.c b/libs/libc/netdb/lib_dnsforeach.c index f0097c547b7..5543820b321 100644 --- a/libs/libc/netdb/lib_dnsforeach.c +++ b/libs/libc/netdb/lib_dnsforeach.c @@ -230,6 +230,7 @@ int dns_foreach_nameserver(dns_callback_t callback, FAR void *arg) #ifdef CONFIG_NET_IPv6 } #endif + if (ret != OK) { fclose(stream); diff --git a/libs/libc/netdb/lib_dnsinit.c b/libs/libc/netdb/lib_dnsinit.c index 5e1ebbf0eb6..efc6a1fe537 100644 --- a/libs/libc/netdb/lib_dnsinit.c +++ b/libs/libc/netdb/lib_dnsinit.c @@ -1,7 +1,8 @@ /**************************************************************************** * libs/libc/netdb/lib_dnsinit.c * - * Copyright (C) 2007, 2009, 2012, 2014-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2012, 2014-2017 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -98,43 +99,43 @@ bool dns_initialize(void) if (!g_dns_address) { #if defined(CONFIG_NETDB_DNSSERVER_IPv4) - struct sockaddr_in addr4; - int ret; + struct sockaddr_in addr4; + int ret; - /* No, configure the default IPv4 DNS server address */ + /* No, configure the default IPv4 DNS server address */ - addr4.sin_family = AF_INET; - addr4.sin_port = HTONS(DNS_DEFAULT_PORT); - addr4.sin_addr.s_addr = HTONL(CONFIG_NETDB_DNSSERVER_IPv4ADDR); + addr4.sin_family = AF_INET; + addr4.sin_port = HTONS(DNS_DEFAULT_PORT); + addr4.sin_addr.s_addr = HTONL(CONFIG_NETDB_DNSSERVER_IPv4ADDR); - ret = dns_add_nameserver((FAR struct sockaddr *)&addr4, - sizeof(struct sockaddr_in)); - if (ret < 0) - { - return false; - } + ret = dns_add_nameserver((FAR struct sockaddr *)&addr4, + sizeof(struct sockaddr_in)); + if (ret < 0) + { + return false; + } #elif defined(CONFIG_NETDB_DNSSERVER_IPv6) - struct sockaddr_in6 addr6; - int ret; + struct sockaddr_in6 addr6; + int ret; - /* No, configure the default IPv6 DNS server address */ + /* No, configure the default IPv6 DNS server address */ - addr6.sin6_family = AF_INET6; - addr6.sin6_port = HTONS(DNS_DEFAULT_PORT); - memcpy(addr6.sin6_addr.s6_addr, g_ipv6_hostaddr, 16); + addr6.sin6_family = AF_INET6; + addr6.sin6_port = HTONS(DNS_DEFAULT_PORT); + memcpy(addr6.sin6_addr.s6_addr, g_ipv6_hostaddr, 16); - ret = dns_add_nameserver((FAR struct sockaddr *)&addr6, - sizeof(struct sockaddr_in6)); - if (ret < 0) - { - return false; - } + ret = dns_add_nameserver((FAR struct sockaddr *)&addr6, + sizeof(struct sockaddr_in6)); + if (ret < 0) + { + return false; + } #else - /* Then we are not ready to perform DNS queries */ + /* Then we are not ready to perform DNS queries */ - return false; + return false; #endif } #endif /* !CONFIG_NETDB_RESOLVCONF */ @@ -157,12 +158,12 @@ void dns_semtake(void) do { - ret = _SEM_WAIT(&g_dns_sem); - if (ret < 0) - { - errcode = _SEM_ERRNO(ret); - DEBUGASSERT(errcode == EINTR || errcode == ECANCELED); - } + ret = _SEM_WAIT(&g_dns_sem); + if (ret < 0) + { + errcode = _SEM_ERRNO(ret); + DEBUGASSERT(errcode == EINTR || errcode == ECANCELED); + } } while (ret < 0 && errcode == EINTR); } diff --git a/libs/libc/netdb/lib_dnsnotify.c b/libs/libc/netdb/lib_dnsnotify.c index 7a897f18a4b..2788b2565fc 100644 --- a/libs/libc/netdb/lib_dnsnotify.c +++ b/libs/libc/netdb/lib_dnsnotify.c @@ -118,10 +118,10 @@ int dns_unregister_notify(dns_callback_t callback, FAR void *arg) if (notify->callback == callback && notify->arg == arg) { - dq_rem(¬ify->entry, &g_dns_notify); - dns_semgive(); - lib_free(notify); - return OK; + dq_rem(¬ify->entry, &g_dns_notify); + dns_semgive(); + lib_free(notify); + return OK; } } @@ -133,7 +133,8 @@ int dns_unregister_notify(dns_callback_t callback, FAR void *arg) * Name: dns_notify_nameserver ****************************************************************************/ -void dns_notify_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) +void dns_notify_nameserver(FAR const struct sockaddr *addr, + socklen_t addrlen) { FAR dq_entry_t *entry; diff --git a/libs/libc/netdb/lib_dnsquery.c b/libs/libc/netdb/lib_dnsquery.c index caf17ba7538..044c9ee7723 100644 --- a/libs/libc/netdb/lib_dnsquery.c +++ b/libs/libc/netdb/lib_dnsquery.c @@ -105,12 +105,12 @@ struct dns_query_info_s struct in6_addr srv_ipv6; /* DNS server address */ #endif } u; - in_port_t srv_port; /* DNS server port */ - uint16_t id; /* Query ID */ - uint16_t rectype; /* Queried record type */ - uint16_t qnamelen; /* Queried hostname length */ - char qname[CONFIG_NETDB_DNSCLIENT_NAMESIZE+2]; /* Queried hostname in encoded - * format + NUL */ + in_port_t srv_port; /* DNS server port */ + uint16_t id; /* Query ID */ + uint16_t rectype; /* Queried record type */ + uint16_t qnamelen; /* Queried hostname length */ + char qname[CONFIG_NETDB_DNSCLIENT_NAMESIZE + 2]; /* Queried hostname in + * encoded format + NUL */ }; /**************************************************************************** @@ -127,7 +127,7 @@ struct dns_query_info_s * * query - A pointer to the starting byte of the name entry in the DNS * response. - * queryend - A pointer to the byte after the last byte of the DNS response. + * queryend - A pointer to the byte after the last byte of the response. * * Returned Value: * Pointer to the first byte after the parsed name, or the value of @@ -143,7 +143,7 @@ static FAR uint8_t *dns_parse_name(FAR uint8_t *query, FAR uint8_t *queryend) { n = *query++; - /* Check for a leading or trailing pointer.*/ + /* Check for a leading or trailing pointer */ if ((n & 0xc0) != 0) { @@ -245,7 +245,7 @@ static int dns_send_query(int sd, FAR const char *name, qname = qinfo->qname; len = 0; do - { + { /* Copy the name string to both query and saved info. */ src++; @@ -394,6 +394,7 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int *naddr, } } #endif + #ifdef CONFIG_NET_IPv6 /* Check for an IPv6 address */ @@ -427,7 +428,7 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int *naddr, } hdr = (FAR struct dns_header_s *)buffer; - endofbuffer = (FAR uint8_t*)buffer + ret; + endofbuffer = (FAR uint8_t *)buffer + ret; ninfo("ID %d\n", ntohs(hdr->id)); ninfo("Query %d\n", hdr->flags1 & DNS_FLAG1_RESPONSE); @@ -479,29 +480,6 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int *naddr, return -EILSEQ; } -#if defined(CONFIG_DEBUG_NET) && defined(CONFIG_DEBUG_INFO) - { - int d = 64; - FAR uint8_t *ptr = nameptr + sizeof(struct dns_question_s); - - lib_dumpbuffer("namestart: ", namestart, nameptr - namestart); - - for (; ; ) - { - ninfo("%02X %02X %02X %02X %02X %02X %02X %02X \n", - ptr[0], ptr[1], ptr[2], ptr[3], - ptr[4], ptr[5], ptr[6], ptr[7]); - - ptr += 8; - d -= 8; - if (d < 0) - { - break; - } - } - } -#endif - /* Since dns_parse_name() skips any pointer bytes, * we cannot compare for equality here. */ @@ -571,8 +549,8 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int *naddr, nameptr += 10 + 4; ninfo("IPv4 address: %d.%d.%d.%d\n", - (ans->u.ipv4.s_addr ) & 0xff, - (ans->u.ipv4.s_addr >> 8 ) & 0xff, + (ans->u.ipv4.s_addr) & 0xff, + (ans->u.ipv4.s_addr >> 8) & 0xff, (ans->u.ipv4.s_addr >> 16) & 0xff, (ans->u.ipv4.s_addr >> 24) & 0xff); @@ -580,7 +558,7 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int *naddr, { FAR struct sockaddr_in *inaddr; - inaddr = (FAR struct sockaddr_in *)&addr[naddr_read].addr; + inaddr = &addr[naddr_read].ipv4; inaddr->sin_family = AF_INET; inaddr->sin_port = 0; inaddr->sin_addr.s_addr = ans->u.ipv4.s_addr; @@ -611,13 +589,13 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int *naddr, ntohs(ans->u.ipv6.s6_addr[7]), ntohs(ans->u.ipv6.s6_addr[6]), ntohs(ans->u.ipv6.s6_addr[5]), ntohs(ans->u.ipv6.s6_addr[4]), ntohs(ans->u.ipv6.s6_addr[3]), ntohs(ans->u.ipv6.s6_addr[2]), - ntohs(ans->u.ipv6.s6_addr[1]), ntohs(ans->u.ipv6.s6_addr[0])); + ntohs(ans->u.ipv6.s6_addr[1]), ntohs(*ans->u.ipv6.s6_addr)); if (naddr_read < *naddr) { FAR struct sockaddr_in6 *inaddr; - inaddr = (FAR struct sockaddr_in6 *)&addr[naddr_read].addr; + inaddr = &addr[naddr_read].ipv6; inaddr->sin6_family = AF_INET6; inaddr->sin6_port = 0; memcpy(inaddr->sin6_addr.s6_addr, ans->u.ipv6.s6_addr, 16); @@ -683,7 +661,7 @@ static int dns_query_callback(FAR void *arg, FAR struct sockaddr *addr, /* Loop while receive timeout errors occur and there are remaining * retries. - */ + */ for (retries = 0; retries < CONFIG_NETDB_DNSCLIENT_RETRIES; retries++) { @@ -852,11 +830,11 @@ static int dns_query_callback(FAR void *arg, FAR struct sockaddr *addr, else #endif { - /* Unsupported address family. Return zero to continue the - * tranversal with the next nameserver address in resolv.conf. - */ + /* Unsupported address family. Return zero to continue the + * tranversal with the next nameserver address in resolv.conf. + */ - return 0; + return 0; } } diff --git a/libs/libc/netdb/lib_gethostbyaddr.c b/libs/libc/netdb/lib_gethostbyaddr.c index 72b59af05da..80cc1553224 100644 --- a/libs/libc/netdb/lib_gethostbyaddr.c +++ b/libs/libc/netdb/lib_gethostbyaddr.c @@ -77,7 +77,8 @@ * ****************************************************************************/ -FAR struct hostent *gethostbyaddr(FAR const void *addr, socklen_t len, int type) +FAR struct hostent *gethostbyaddr(FAR const void *addr, + socklen_t len, int type) { int ret; diff --git a/libs/libc/netdb/lib_gethostbyaddrr.c b/libs/libc/netdb/lib_gethostbyaddrr.c index 7ecf41517c6..0199bd0c86b 100644 --- a/libs/libc/netdb/lib_gethostbyaddrr.c +++ b/libs/libc/netdb/lib_gethostbyaddrr.c @@ -311,7 +311,7 @@ int lib_hostfile_lookup(FAR const void *addr, socklen_t len, int type, goto errorout_with_stream; } } - else if (nread > 0 && len == host->h_length && type == host->h_addrtype) + else if (len == host->h_length && type == host->h_addrtype) { /* We successfully read the entry and the type and size of the * address is good. Now compare the addresses: diff --git a/libs/libc/netdb/lib_gethostbynamer.c b/libs/libc/netdb/lib_gethostbynamer.c index 1cdf5eda377..fc4cf82ca34 100644 --- a/libs/libc/netdb/lib_gethostbynamer.c +++ b/libs/libc/netdb/lib_gethostbynamer.c @@ -94,7 +94,8 @@ struct hostent_info_s * ****************************************************************************/ -static int lib_numeric_address(FAR const char *name, FAR struct hostent *host, +static int lib_numeric_address(FAR const char *name, + FAR struct hostent *host, FAR char *buf, size_t buflen) { FAR struct hostent_info_s *info; @@ -108,9 +109,9 @@ static int lib_numeric_address(FAR const char *name, FAR struct hostent *host, */ if (buflen <= sizeof(struct hostent_info_s)) - { - return -ERANGE; - } + { + return -ERANGE; + } info = (FAR struct hostent_info_s *)buf; ptr = info->hi_data; @@ -341,9 +342,9 @@ static int lib_find_answer(FAR const char *name, FAR struct hostent *host, */ if (buflen <= sizeof(struct hostent_info_s)) - { - return -ERANGE; - } + { + return -ERANGE; + } /* Initialize buffers */ @@ -503,9 +504,9 @@ static int lib_dns_lookup(FAR const char *name, FAR struct hostent *host, */ if (buflen <= sizeof(struct hostent_info_s)) - { - return -ERANGE; - } + { + return -ERANGE; + } /* Initialize buffers */ @@ -609,8 +610,10 @@ static int lib_dns_lookup(FAR const char *name, FAR struct hostent *host, ****************************************************************************/ #ifdef CONFIG_NETDB_HOSTFILE -static int lib_hostfile_lookup(FAR const char *name, FAR struct hostent *host, - FAR char *buf, size_t buflen, int *h_errnop) +static int lib_hostfile_lookup(FAR const char *name, + FAR struct hostent *host, + FAR char *buf, size_t buflen, + FAR int *h_errnop) { FAR FILE *stream; int herrnocode; @@ -734,8 +737,8 @@ errorout_with_herrnocode: * and its struct in_addr equivalent into the h_addr_list[0] field of the * returned hostent structure. * - * gethostname_r() is *not* POSIX but is similar to a Glibc extension and is - * used internally by NuttX to implement the POSIX gethostname(). + * gethostname_r() is *not* POSIX but is similar to a Glibc extension and + * is used internally by NuttX to implement the POSIX gethostname(). * * Input Parameters: * name - The name of the host to find. @@ -784,7 +787,6 @@ int gethostbyname_r(FAR const char *name, FAR struct hostent *host, #endif /* Try to find the name in the HOSTALIASES environment variable */ - /* REVISIT: Not implemented */ #ifdef CONFIG_NETDB_DNSCLIENT #if CONFIG_NETDB_DNSCLIENT_ENTRIES > 0 diff --git a/libs/libc/netdb/lib_getnameinfo.c b/libs/libc/netdb/lib_getnameinfo.c index 32ab99017c8..31ad660fcfb 100644 --- a/libs/libc/netdb/lib_getnameinfo.c +++ b/libs/libc/netdb/lib_getnameinfo.c @@ -100,8 +100,8 @@ int getnameinfo(FAR const struct sockaddr *addr, socklen_t addrlen, struct hostent hostent; int h_errno; - ret = gethostbyaddr_r(saddr, saddr_len, addr->sa_family, &hostent, host, - hostlen, &h_errno); + ret = gethostbyaddr_r(saddr, saddr_len, addr->sa_family, &hostent, + host, hostlen, &h_errno); if (ret == OK) { diff --git a/libs/libc/netdb/lib_getservbyname.c b/libs/libc/netdb/lib_getservbyname.c index 697920ddb92..a8ac68be511 100644 --- a/libs/libc/netdb/lib_getservbyname.c +++ b/libs/libc/netdb/lib_getservbyname.c @@ -51,7 +51,8 @@ * Name: getservbyname ****************************************************************************/ -FAR struct servent *getservbyname(FAR const char *name, FAR const char *proto) +FAR struct servent *getservbyname(FAR const char *name, + FAR const char *proto) { static struct servent ent; struct servent *res; diff --git a/libs/libc/netdb/lib_netdb.c b/libs/libc/netdb/lib_netdb.c index 8a040fe4c94..c90e80a3484 100644 --- a/libs/libc/netdb/lib_netdb.c +++ b/libs/libc/netdb/lib_netdb.c @@ -57,7 +57,6 @@ char g_hostbuffer[CONFIG_NETDB_BUFSIZE]; * macro or an identifier declared with external linkage. */ -/* REVISIT: This should at least be per-task? */ int h_errno; /**************************************************************************** diff --git a/libs/libc/netdb/lib_parsehostfile.c b/libs/libc/netdb/lib_parsehostfile.c index cddb1a48851..156b81a0ea4 100644 --- a/libs/libc/netdb/lib_parsehostfile.c +++ b/libs/libc/netdb/lib_parsehostfile.c @@ -281,9 +281,9 @@ ssize_t lib_parse_hostfile(FAR FILE *stream, FAR struct hostent *host, */ if (buflen <= sizeof(struct hostent_info_s)) - { - return -ERANGE; - } + { + return -ERANGE; + } info = (FAR struct hostent_info_s *)buf; ptr = info->hi_data; @@ -306,7 +306,7 @@ ssize_t lib_parse_hostfile(FAR FILE *stream, FAR struct hostent *host, if (ch == '#') { - /* Skip to the end of line. */ + /* Skip to the end of line. */ ch = lib_skipline(stream, &nread); if (ch == EOF) @@ -456,13 +456,13 @@ ssize_t lib_parse_hostfile(FAR FILE *stream, FAR struct hostent *host, return nwritten; } - /* Save the pointer to the beginning of the next alias */ + /* Save the pointer to the beginning of the next alias */ - info->hi_aliases[i] = start; - if (host->h_aliases == NULL) - { - host->h_aliases = info->hi_aliases; - } + info->hi_aliases[i] = start; + if (host->h_aliases == NULL) + { + host->h_aliases = info->hi_aliases; + } if (!lib_isspace(ch)) {