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/nuttx.git
commit 319501e9ef38f88ce97ce204ca10a389090bfde9 Author: dongjiuzhu1 <[email protected]> AuthorDate: Mon Jun 3 16:55:36 2024 +0800 libs/libc: remove LIB_BUFLEN_UNKNOWN to reduce depends on libc.h 1. remove libc.h 2. include <nuttx/stream.h>, remove stdio.h, becuase stream.h include stdio.h Signed-off-by: dongjiuzhu1 <[email protected]> --- libs/libc/libc.h | 2 -- libs/libc/stdio/lib_sprintf.c | 5 ++--- libs/libc/stdio/lib_vsprintf.c | 8 ++------ libs/libc/stdio/lib_vsscanf.c | 8 +------- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/libs/libc/libc.h b/libs/libc/libc.h index 8e3a038fb5..b531fa87ff 100644 --- a/libs/libc/libc.h +++ b/libs/libc/libc.h @@ -53,8 +53,6 @@ # define CONFIG_LIBC_HOMEDIR "/" #endif -#define LIB_BUFLEN_UNKNOWN INT_MAX - #if ((!defined(CONFIG_LIBC_PREVENT_MEMCHR_USER) && !defined(__KERNEL__)) || \ (!defined(CONFIG_LIBC_PREVENT_MEMCHR_KERNEL) && defined(__KERNEL__))) # define LIBC_BUILD_MEMCHR diff --git a/libs/libc/stdio/lib_sprintf.c b/libs/libc/stdio/lib_sprintf.c index d99840a815..1536828e5d 100644 --- a/libs/libc/stdio/lib_sprintf.c +++ b/libs/libc/stdio/lib_sprintf.c @@ -22,8 +22,7 @@ * Included Files ****************************************************************************/ -#include <stdio.h> -#include "libc.h" +#include <nuttx/streams.h> /**************************************************************************** * Public Functions @@ -41,7 +40,7 @@ int sprintf(FAR char *buf, FAR const IPTR char *fmt, ...) /* Initialize a memory stream to write to the buffer */ - lib_memoutstream(&memoutstream, buf, LIB_BUFLEN_UNKNOWN); + lib_memoutstream(&memoutstream, buf, INT_MAX); /* Then let lib_vsprintf do the real work */ diff --git a/libs/libc/stdio/lib_vsprintf.c b/libs/libc/stdio/lib_vsprintf.c index 08378f7f08..b474a63ac9 100644 --- a/libs/libc/stdio/lib_vsprintf.c +++ b/libs/libc/stdio/lib_vsprintf.c @@ -22,11 +22,7 @@ * Included Files ****************************************************************************/ -#include <nuttx/config.h> - -#include <stdio.h> - -#include "libc.h" +#include <nuttx/streams.h> /**************************************************************************** * Public Functions @@ -44,6 +40,6 @@ int vsprintf(FAR char *dest, FAR const IPTR char *src, va_list ap) * libs/libc/stdio/lib_vsprintf do the work. */ - lib_memoutstream(&memoutstream, dest, LIB_BUFLEN_UNKNOWN); + lib_memoutstream(&memoutstream, dest, INT_MAX); return lib_vsprintf(&memoutstream.common, src, ap); } diff --git a/libs/libc/stdio/lib_vsscanf.c b/libs/libc/stdio/lib_vsscanf.c index 5b53a9e021..6be4a0c2fa 100644 --- a/libs/libc/stdio/lib_vsscanf.c +++ b/libs/libc/stdio/lib_vsscanf.c @@ -22,14 +22,8 @@ * Included Files ****************************************************************************/ -#include <nuttx/config.h> - -#include <stdio.h> - #include <nuttx/streams.h> -#include "libc.h" - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -45,7 +39,7 @@ int vsscanf(FAR const char *buf, FAR const IPTR char *fmt, va_list ap) /* Initialize a memory stream to freadm from the buffer */ - lib_meminstream(&meminstream, buf, LIB_BUFLEN_UNKNOWN); + lib_meminstream(&meminstream, buf, INT_MAX); /* Then let lib_vscanf do the real work */
