diff mbox series

[v9,04/11] lib: sbi: Add ' ' '\'' flags for print

Message ID 20230709160231.202121-5-wxjstz@126.com
State Accepted
Headers show
Series Improve sbi_console | expand

Commit Message

Xiang W July 9, 2023, 4:02 p.m. UTC
The space flag is used to add a space before positive numbers, and
apostrophe is used to print the thousand separator. Add code to
ignore these two flags

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
---
 lib/sbi/sbi_console.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/lib/sbi/sbi_console.c b/lib/sbi/sbi_console.c
index 6ebdc44..b6b23bf 100644
--- a/lib/sbi/sbi_console.c
+++ b/lib/sbi/sbi_console.c
@@ -288,6 +288,10 @@  static int print(char **out, u32 *out_len, const char *format, va_list args)
 				case '0':
 					flags |= PAD_ZERO;
 					break;
+				case ' ':
+				case '\'':
+					/* Ignored flags, do nothing */
+					break;
 				default:
 					flags_done = true;
 					break;