summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2016-05-31 21:12:46 (GMT)
committerTom Rini <trini@konsulko.com>2016-06-03 01:21:42 (GMT)
commitabeb272d22217481c214495818c3ceabad57b9c0 (patch)
tree616d2461cef18c3611910dd1f98b614864d36f79 /lib
parentb4ba1693ef25aa0050c5aa254a0d1c4ed0af65f3 (diff)
downloadu-boot-abeb272d22217481c214495818c3ceabad57b9c0.tar.xz
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 <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: Tom Rini <trini@konsulko.com> Reviewed-by: Sylvain Lesne <lesne@alse-fr.com> Tested-by: Sylvain Lesne <lesne@alse-fr.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/tiny-printf.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 4b70263..5ea2555 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;
+}