mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
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:
parent
a537ecdd0f
commit
319501e9ef
4 changed files with 5 additions and 18 deletions
|
@ -53,8 +53,6 @@
|
||||||
# define CONFIG_LIBC_HOMEDIR "/"
|
# define CONFIG_LIBC_HOMEDIR "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LIB_BUFLEN_UNKNOWN INT_MAX
|
|
||||||
|
|
||||||
#if ((!defined(CONFIG_LIBC_PREVENT_MEMCHR_USER) && !defined(__KERNEL__)) || \
|
#if ((!defined(CONFIG_LIBC_PREVENT_MEMCHR_USER) && !defined(__KERNEL__)) || \
|
||||||
(!defined(CONFIG_LIBC_PREVENT_MEMCHR_KERNEL) && defined(__KERNEL__)))
|
(!defined(CONFIG_LIBC_PREVENT_MEMCHR_KERNEL) && defined(__KERNEL__)))
|
||||||
# define LIBC_BUILD_MEMCHR
|
# define LIBC_BUILD_MEMCHR
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <nuttx/streams.h>
|
||||||
#include "libc.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* 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 */
|
/* 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 */
|
/* Then let lib_vsprintf do the real work */
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,7 @@
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/streams.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "libc.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* 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.
|
* 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);
|
return lib_vsprintf(&memoutstream.common, src, ap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,14 +22,8 @@
|
||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <nuttx/streams.h>
|
#include <nuttx/streams.h>
|
||||||
|
|
||||||
#include "libc.h"
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* 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 */
|
/* 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 */
|
/* Then let lib_vscanf do the real work */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue