[PATCH 2/2] command: Move command completion temporary buffer to stack

Marek Vasut marek.vasut+renesas at mailbox.org
Sat Dec 2 21:52:31 CET 2023


The command completion temporary buffer seems to be only
used by the argv tokenizer, move it to stack. This saves
2 kiB from the binary size (depends on configuration) per:
$ aarch64-linux-gnu-readelf -s u-boot | sort -n -k 3

Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Simon Glass <sjg at chromium.org>
---
 common/command.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/command.c b/common/command.c
index 846e16e2ada..7821c273dae 100644
--- a/common/command.c
+++ b/common/command.c
@@ -355,10 +355,9 @@ static int find_common_prefix(char *const argv[])
 	return len;
 }
 
-static char tmp_buf[CONFIG_SYS_CBSIZE + 1];	/* copy of console I/O buffer */
-
 int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp)
 {
+	char tmp_buf[CONFIG_SYS_CBSIZE + 1];	/* copy of console I/O buffer */
 	int n = *np, col = *colp;
 	char *argv[CONFIG_SYS_MAXARGS + 1];		/* NULL terminated	*/
 	char *cmdv[20];
-- 
2.42.0



More information about the U-Boot mailing list