You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/11/27 19:07:46 UTC

[incubator-nuttx] branch master updated (919aece -> 5da9dbe)

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.


    from 919aece  boards/same70-xplained: fix usage of SAMV71XULT instead of SAME70XPLAINED
     new b5f6dcb  libc/getdelim: Remove __KERNEL__ check since it shouldn't be called inside kernel
     new 5da9dbe  libc/gets: Remove the unnecessary cast

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 libs/libc/stdio/lib_fgets.c    |  2 +-
 libs/libc/stdio/lib_getdelim.c | 14 +++-----------
 libs/libc/stdio/lib_gets.c     |  2 +-
 libs/libc/stdio/lib_gets_s.c   |  4 ++--
 4 files changed, 7 insertions(+), 15 deletions(-)

[incubator-nuttx] 01/02: libc/getdelim: Remove __KERNEL__ check since it shouldn't be called inside kernel

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit b5f6dcb5237dcb1abefb559f8f35dc07b6d2aa72
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Nov 18 02:10:30 2021 +0800

    libc/getdelim: Remove __KERNEL__ check since it shouldn't be called inside kernel
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_getdelim.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/libs/libc/stdio/lib_getdelim.c b/libs/libc/stdio/lib_getdelim.c
index 2da53d2..2704955 100644
--- a/libs/libc/stdio/lib_getdelim.c
+++ b/libs/libc/stdio/lib_getdelim.c
@@ -107,7 +107,7 @@ ssize_t getdelim(FAR char **lineptr, size_t *n, int delimiter,
 
   if (lineptr == NULL || n == NULL || stream == NULL)
     {
-      ret = -EINVAL;
+      ret = EINVAL;
       goto errout;
     }
 
@@ -138,7 +138,7 @@ ssize_t getdelim(FAR char **lineptr, size_t *n, int delimiter,
       dest = (FAR char *)lib_malloc(bufsize);
       if (dest == NULL)
         {
-          ret = -ENOMEM;
+          ret = ENOMEM;
           goto errout;
         }
 
@@ -188,13 +188,9 @@ ssize_t getdelim(FAR char **lineptr, size_t *n, int delimiter,
       ch = fgetc(stream);
       if (ch == EOF)
         {
-#ifdef __KERNEL_
-          return -ENODATA;
-#else
           /* errno is not set in this case */
 
           return -1;
-#endif
         }
 
       /* Save the character in the user buffer and increment the number of
@@ -218,12 +214,8 @@ ssize_t getdelim(FAR char **lineptr, size_t *n, int delimiter,
   return ncopied;
 
 errout:
-#ifdef __KERNEL_
-  return ret;
-#else
-  set_errno(-ret);
+  set_errno(ret);
   return -1;
-#endif
 }
 
 /****************************************************************************

[incubator-nuttx] 02/02: libc/gets: Remove the unnecessary cast

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 5da9dbe57af2d9b0b22c6cf1b92e76dfe6dcb67b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Nov 18 02:12:01 2021 +0800

    libc/gets: Remove the unnecessary cast
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 libs/libc/stdio/lib_fgets.c  | 2 +-
 libs/libc/stdio/lib_gets.c   | 2 +-
 libs/libc/stdio/lib_gets_s.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libs/libc/stdio/lib_fgets.c b/libs/libc/stdio/lib_fgets.c
index 0edc2f5..9485e23 100644
--- a/libs/libc/stdio/lib_fgets.c
+++ b/libs/libc/stdio/lib_fgets.c
@@ -57,6 +57,6 @@ char *fgets(FAR char *buf, int buflen, FAR FILE *stream)
 
   else
     {
-      return lib_fgets(buf, (size_t)buflen, stream, true, false);
+      return lib_fgets(buf, buflen, stream, true, false);
     }
 }
diff --git a/libs/libc/stdio/lib_gets.c b/libs/libc/stdio/lib_gets.c
index 6ecde39..2a25e8f 100644
--- a/libs/libc/stdio/lib_gets.c
+++ b/libs/libc/stdio/lib_gets.c
@@ -58,5 +58,5 @@ FAR char *gets(FAR char *s)
 {
   /* Let lib_fgets() do the heavy lifting */
 
-  return lib_fgets(s, (size_t)INT_MAX, stdin, false, false);
+  return lib_fgets(s, SIZE_MAX, stdin, false, false);
 }
diff --git a/libs/libc/stdio/lib_gets_s.c b/libs/libc/stdio/lib_gets_s.c
index 72aa929..ddcaa81 100644
--- a/libs/libc/stdio/lib_gets_s.c
+++ b/libs/libc/stdio/lib_gets_s.c
@@ -41,7 +41,7 @@
  *   either a terminating newline or EOF, which it replaces with '\0'.  Reads
  *   at most n-1 characters from stdin into the array pointed to by str until
  *   new-line character, end-of-file condition, or read error.   The newline
- *   character, if encountered, is not saved in the arraay.  A NUL character
+ *   character, if encountered, is not saved in the array.  A NUL character
  *   is written immediately after the last character read into the array, or
  *   to str[0] if no characters were read.
  *
@@ -69,5 +69,5 @@ FAR char *gets_s(FAR char *s, rsize_t n)
 
   /* Then let lib_fgets() do the heavy lifting */
 
-  return lib_fgets(s, (size_t)n, stdin, false, true);
+  return lib_fgets(s, n, stdin, false, true);
 }