mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-10 05:36:15 +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;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef BH_PLATFORM_OPENRTOS
|
#ifndef BUILTIN_LIBC_BUFFERED_PRINTF
|
||||||
PRIVILEGED_DATA static char print_buf[128] = { 0 };
|
#define BUILTIN_LIBC_BUFFERED_PRINTF 0
|
||||||
PRIVILEGED_DATA static int print_buf_size = 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
|
static int
|
||||||
printf_out(int c, struct str_context *ctx)
|
printf_out(int c, struct str_context *ctx)
|
||||||
|
|
|
@ -77,6 +77,10 @@ typedef sem_t korp_sem;
|
||||||
#define CONFIG_HAS_ISATTY 0
|
#define CONFIG_HAS_ISATTY 0
|
||||||
#endif
|
#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.
|
* NuttX doesn't have openat family.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user