This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push: new 76e58d9 Fixed coding std violations in nsh_fsutils.h 76e58d9 is described below commit 76e58d9e555c59450854726c38a270ed19e74ce1 Author: Subhra Sankha Sarkar <rurtle.co...@gmail.com> AuthorDate: Wed Oct 28 18:00:33 2020 +0530 Fixed coding std violations in nsh_fsutils.h --- nshlib/nsh_fsutils.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/nshlib/nsh_fsutils.c b/nshlib/nsh_fsutils.c index 2bb958f..9d8cf27 100644 --- a/nshlib/nsh_fsutils.c +++ b/nshlib/nsh_fsutils.c @@ -102,7 +102,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, } buffer = (FAR char *)malloc(IOBUFFERSIZE); - if(buffer == NULL) + if (buffer == NULL) { close(fd); nsh_error(vtbl, g_fmtcmdfailed, cmd, "malloc", NSH_ERRNO); @@ -111,7 +111,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, /* And just dump it byte for byte into stdout */ - for (;;) + for (; ; ) { int nbytesread = read(fd, buffer, IOBUFFERSIZE); @@ -129,7 +129,8 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, } else { - nsh_error(vtbl, g_fmtcmdfailed, cmd, "read", NSH_ERRNO_OF(errval)); + nsh_error(vtbl, g_fmtcmdfailed, cmd, "read", + NSH_ERRNO_OF(errval)); } ret = ERROR; @@ -144,7 +145,8 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, while (nbyteswritten < nbytesread) { - ssize_t n = nsh_write(vtbl, buffer + nbyteswritten, nbytesread - nbyteswritten); + ssize_t n = nsh_write(vtbl, buffer + nbyteswritten, + nbytesread - nbyteswritten); if (n < 0) { int errcode = errno; @@ -179,18 +181,18 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, } } - /* NOTE that the following NSH prompt may appear on the same line as file - * content. The IEEE Std requires that "The standard output shall - * contain the sequence of bytes read from the input files. Nothing else - * shall be written to the standard output." Reference: - * https://pubs.opengroup.org/onlinepubs/009695399/utilities/cat.html. - */ + /* NOTE that the following NSH prompt may appear on the same line as file + * content. The IEEE Std requires that "The standard output shall + * contain the sequence of bytes read from the input files. Nothing else + * shall be written to the standard output." Reference: + * https://pubs.opengroup.org/onlinepubs/009695399/utilities/cat.html. + */ - /* Close the input file and return the result */ + /* Close the input file and return the result */ - close(fd); - free(buffer); - return ret; + close(fd); + free(buffer); + return ret; } #endif