提交 abeb272d 编写于 作者: M Marek Vasut 提交者: Tom Rini

tiny-printf: Support sprintf()

Add a simple version of this function for SPL. It does not check the buffer
size as this would add to the code size.
Signed-off-by: NMarek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefan Roese <sr@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: lesne@alse-fr.com
Reviewed-by: NTom Rini <trini@konsulko.com>
Reviewed-by: NSylvain Lesne <lesne@alse-fr.com>
Tested-by: NSylvain Lesne <lesne@alse-fr.com>
上级 b4ba1693
......@@ -147,8 +147,7 @@ static void putc_outstr(char ch)
*outstr++ = ch;
}
/* Note that size is ignored */
int snprintf(char *buf, size_t size, const char *fmt, ...)
int sprintf(char *buf, const char *fmt, ...)
{
va_list va;
int ret;
......@@ -161,3 +160,16 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
return ret;
}
/* Note that size is ignored */
int snprintf(char *buf, size_t size, const char *fmt, ...)
{
va_list va;
int ret;
va_start(va, fmt);
ret = sprintf(buf, fmt, va);
va_end(va);
return ret;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册