MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / __wrap_rtl_printf

Function __wrap_rtl_printf

bsp/amebaz/drivers/board.c:29–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28#ifdef __GNUC__
29void __wrap_rtl_printf(const char *fmt, ...)
30{
31 va_list args;
32 rt_size_t length;
33 static char rt_log_buf[RT_CONSOLEBUF_SIZE];
34
35 va_start(args, fmt);
36 /* the return value of vsnprintf is the number of bytes that would be
37 * written to buffer had if the size of the buffer been sufficiently
38 * large excluding the terminating null byte. If the output string
39 * would be larger than the rt_log_buf, we have to adjust the output
40 * length. */
41 length = rt_vsnprintf(rt_log_buf, sizeof(rt_log_buf) - 1, fmt, args);
42 if (length > RT_CONSOLEBUF_SIZE - 1)
43 length = RT_CONSOLEBUF_SIZE - 1;
44 rt_kprintf("%s", rt_log_buf);
45 va_end(args);
46}
47#endif
48
49/**

Callers

nothing calls this directly

Calls 2

rt_kprintfFunction · 0.85
rt_vsnprintfFunction · 0.50

Tested by

no test coverage detected