diff mbox series

[2/5] lib/vsprintf.c: implement printf() in terms of vprintf()

Message ID 20210520100528.322846-3-rasmus.villemoes@prevas.dk
State Superseded
Delegated to: Tom Rini
Headers show
Series assorted printf-related patches | expand

Commit Message

Rasmus Villemoes May 20, 2021, 10:05 a.m. UTC
This saves some code, both in terms of #LOC and .text size, and it is
also the normal convention that foo(...) is implemented in terms of
vfoo().

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
---
 lib/vsprintf.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Simon Glass May 20, 2021, 5:51 p.m. UTC | #1
On Thu, 20 May 2021 at 04:05, Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> This saves some code, both in terms of #LOC and .text size, and it is
> also the normal convention that foo(...) is implemented in terms of
> vfoo().
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
>  lib/vsprintf.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 0050110683..e3bec7489b 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -785,19 +785,11 @@  int printf(const char *fmt, ...)
 {
 	va_list args;
 	uint i;
-	char printbuffer[CONFIG_SYS_PBSIZE];
 
 	va_start(args, fmt);
-
-	/*
-	 * For this to work, printbuffer must be larger than
-	 * anything we ever want to print.
-	 */
-	i = vscnprintf(printbuffer, sizeof(printbuffer), fmt, args);
+	i = vprintf(fmt, args);
 	va_end(args);
 
-	/* Print the string */
-	puts(printbuffer);
 	return i;
 }