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 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
dongjiuzhu1 2024-06-03 16:55:36 +08:00 committed by Xiang Xiao
parent a537ecdd0f
commit 319501e9ef
4 changed files with 5 additions and 18 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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);
}

View File

@ -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 */