From 84e5130ac5fe2837a5bce8ca014e0000f1d596f5 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Mon, 8 Feb 2021 13:31:54 +0100 Subject: [PATCH] software/bios/console: Call putsnonl() from puts() puts() and putsnonl() are very similar, and can share code. Reduce code size by making the former call the latter. Impact for a RISC-V build: $ size console.o.orig console.o text data bss dec hex filename 868 0 12 880 370 console.o.orig 832 0 12 844 34c console.o Signed-off-by: Geert Uytterhoeven --- litex/soc/software/libbase/console.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/litex/soc/software/libbase/console.c b/litex/soc/software/libbase/console.c index ec434643b..cd62b5c68 100644 --- a/litex/soc/software/libbase/console.c +++ b/litex/soc/software/libbase/console.c @@ -75,10 +75,7 @@ int readchar_nonblock(void) int puts(const char *s) { - while(*s) { - putchar(*s); - s++; - } + putsnonl(s); putchar('\n'); return 1; }