提交 29871c0d 编写于 作者: B Bernard Xiong

Merge pull request #159 from grissiom/misc-fix

kservice: export vsnprintf as rt_vsnprintf
...@@ -469,6 +469,7 @@ int rt_system_module_init(void); ...@@ -469,6 +469,7 @@ int rt_system_module_init(void);
void rt_kprintf(const char *fmt, ...); void rt_kprintf(const char *fmt, ...);
#endif #endif
rt_int32_t rt_vsprintf(char *dest, const char *format, va_list arg_ptr); rt_int32_t rt_vsprintf(char *dest, const char *format, va_list arg_ptr);
rt_int32_t rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args);
rt_int32_t rt_sprintf(char *buf ,const char *format, ...); rt_int32_t rt_sprintf(char *buf ,const char *format, ...);
rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *format, ...); rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *format, ...);
......
...@@ -718,10 +718,10 @@ static char *print_number(char *buf, ...@@ -718,10 +718,10 @@ static char *print_number(char *buf,
return buf; return buf;
} }
static rt_int32_t vsnprintf(char *buf, rt_int32_t rt_vsnprintf(char *buf,
rt_size_t size, rt_size_t size,
const char *fmt, const char *fmt,
va_list args) va_list args)
{ {
#ifdef RT_PRINTF_LONGLONG #ifdef RT_PRINTF_LONGLONG
unsigned long long num; unsigned long long num;
...@@ -976,6 +976,7 @@ static rt_int32_t vsnprintf(char *buf, ...@@ -976,6 +976,7 @@ static rt_int32_t vsnprintf(char *buf,
*/ */
return str - buf; return str - buf;
} }
RTM_EXPORT(rt_vsnprintf);
/** /**
* This function will fill a formatted string to buffer * This function will fill a formatted string to buffer
...@@ -990,7 +991,7 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...) ...@@ -990,7 +991,7 @@ rt_int32_t rt_snprintf(char *buf, rt_size_t size, const char *fmt, ...)
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
n = vsnprintf(buf, size, fmt, args); n = rt_vsnprintf(buf, size, fmt, args);
va_end(args); va_end(args);
return n; return n;
...@@ -1006,7 +1007,7 @@ RTM_EXPORT(rt_snprintf); ...@@ -1006,7 +1007,7 @@ RTM_EXPORT(rt_snprintf);
*/ */
rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr) rt_int32_t rt_vsprintf(char *buf, const char *format, va_list arg_ptr)
{ {
return vsnprintf(buf, (rt_size_t) -1, format, arg_ptr); return rt_vsnprintf(buf, (rt_size_t) -1, format, arg_ptr);
} }
RTM_EXPORT(rt_vsprintf); RTM_EXPORT(rt_vsprintf);
...@@ -1114,7 +1115,7 @@ void rt_kprintf(const char *fmt, ...) ...@@ -1114,7 +1115,7 @@ void rt_kprintf(const char *fmt, ...)
* large excluding the terminating null byte. If the output string * large excluding the terminating null byte. If the output string
* would be larger than the rt_log_buf, we have to adjust the output * would be larger than the rt_log_buf, we have to adjust the output
* length. */ * length. */
length = vsnprintf(rt_log_buf, sizeof(rt_log_buf) - 1, fmt, args); length = rt_vsnprintf(rt_log_buf, sizeof(rt_log_buf) - 1, fmt, args);
if (length > RT_CONSOLEBUF_SIZE - 1) if (length > RT_CONSOLEBUF_SIZE - 1)
length = RT_CONSOLEBUF_SIZE - 1; length = RT_CONSOLEBUF_SIZE - 1;
#ifdef RT_USING_DEVICE #ifdef RT_USING_DEVICE
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册