mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-11-26 15:32:05 +00:00
Make libc-builtin buffered printf be a common feature (#1483)
Add macros to control whether to use the libc-builtin buffered printf and the buffer size.
This commit is contained in:
parent
ab929c20a3
commit
bbea005db6
|
@ -345,9 +345,24 @@ sprintf_out(int c, struct str_context *ctx)
|
|||
return c;
|
||||
}
|
||||
|
||||
#ifdef BH_PLATFORM_OPENRTOS
|
||||
PRIVILEGED_DATA static char print_buf[128] = { 0 };
|
||||
PRIVILEGED_DATA static int print_buf_size = 0;
|
||||
#ifndef BUILTIN_LIBC_BUFFERED_PRINTF
|
||||
#define BUILTIN_LIBC_BUFFERED_PRINTF 0
|
||||
#endif
|
||||
|
||||
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_SIZE
|
||||
#define BUILTIN_LIBC_BUFFERED_PRINT_SIZE 128
|
||||
#endif
|
||||
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
|
||||
#define BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
|
||||
#endif
|
||||
|
||||
#if BUILTIN_LIBC_BUFFERED_PRINTF != 0
|
||||
|
||||
BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
|
||||
static char print_buf[BUILTIN_LIBC_BUFFERED_PRINT_SIZE] = { 0 };
|
||||
|
||||
BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
|
||||
static int print_buf_size = 0;
|
||||
|
||||
static int
|
||||
printf_out(int c, struct str_context *ctx)
|
||||
|
|
|
@ -77,6 +77,10 @@ typedef sem_t korp_sem;
|
|||
#define CONFIG_HAS_ISATTY 0
|
||||
#endif
|
||||
|
||||
#define BUILTIN_LIBC_BUFFERED_PRINTF 1
|
||||
#define BUILTIN_LIBC_BUFFERED_PRINT_SIZE 128
|
||||
#define BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
|
||||
|
||||
/*
|
||||
* NuttX doesn't have openat family.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue
Block a user