lib: sbi: print not fill '0' when left-aligned

Left alignment and padding '0' should not exist at the same time,
this patch skips padding.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Xiang W 2023-07-10 00:02:22 +08:00 committed by Anup Patel
parent 6053917626
commit 35ef182690

View file

@ -288,6 +288,8 @@ static int print(char **out, u32 *out_len, const char *format, va_list args)
if (!flags_done)
++format;
}
if (flags & PAD_RIGHT)
flags &= ~PAD_ZERO;
/* Get width */
for (; *format >= '0' && *format <= '9'; ++format) {
width *= 10;