From: Marek Vasut Date: Tue, 31 May 2016 21:12:46 +0000 (+0200) Subject: tiny-printf: Support sprintf() X-Git-Tag: v2016.07-rc1~55 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=abeb272d22217481c214495818c3ceabad57b9c0;p=u-boot 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: Marek Vasut Cc: Simon Glass Cc: Stefan Roese Cc: Tom Rini Cc: lesne@alse-fr.com Reviewed-by: Tom Rini Reviewed-by: Sylvain Lesne Tested-by: Sylvain Lesne --- diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index 4b70263df7..5ea2555280 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -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; +}