diff mbox series

[U-Boot,v2,01/10] tiny-printf: Reduce size by removing ctype

Message ID 20191021232652.132164-2-sjg@chromium.org
State Accepted
Commit 1c1c8a3a990742a73a75b091c35213b0a50f0c45
Delegated to: Simon Glass
Headers show
Series bootstage: TPL and SPL improvements | expand

Commit Message

Simon Glass Oct. 21, 2019, 11:26 p.m. UTC
The ctype array is brought into the image, adding 256 bytes, when it is
unlikely to be needed. The extra code for %p is only present when DEBUG
is defined, so let's drop ctype as well unless DEBUG is defined.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 lib/tiny-printf.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Simon Glass Oct. 29, 2019, 11:21 p.m. UTC | #1
The ctype array is brought into the image, adding 256 bytes, when it is
unlikely to be needed. The extra code for %p is only present when DEBUG
is defined, so let's drop ctype as well unless DEBUG is defined.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 lib/tiny-printf.c | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index ebef92fc9f6..632b4249142 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -289,8 +289,15 @@  static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
 				break;
 			case 'p':
 				pointer(info, fmt, va_arg(va, void *));
+				/*
+				 * Skip this because it pulls in _ctype which is
+				 * 256 bytes, and we don't generally implement
+				 * pointer anyway
+				 */
+#ifdef DEBUG
 				while (isalnum(fmt[0]))
 					fmt++;
+#endif
 				break;
 			case '%':
 				out(info, '%');