public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] tiny-printf: Support sprintf()
@ 2016-05-31 21:12 Marek Vasut
  2016-05-31 21:12 ` [U-Boot] [PATCH 2/2] ARM: omap: Enable tiny printf on omap3_logic Marek Vasut
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Marek Vasut @ 2016-05-31 21:12 UTC (permalink / raw)
  To: u-boot

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 at alse-fr.com
---
 lib/tiny-printf.c | 16 ++++++++++++++--
 1 file 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;
+}
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-03 14:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-31 21:12 [U-Boot] [PATCH 1/2] tiny-printf: Support sprintf() Marek Vasut
2016-05-31 21:12 ` [U-Boot] [PATCH 2/2] ARM: omap: Enable tiny printf on omap3_logic Marek Vasut
2016-05-31 22:55   ` Tom Rini
2016-06-03 14:00   ` [U-Boot] [U-Boot, " Tom Rini
2016-05-31 22:55 ` [U-Boot] [PATCH 1/2] tiny-printf: Support sprintf() Tom Rini
2016-06-01  8:16 ` Sylvain Lesne
2016-06-03 14:00 ` [U-Boot] [U-Boot,1/2] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox