[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYeUvCECL1HQpIi_@1wt.eu>
Date: Sat, 7 Feb 2026 20:38:36 +0100
From: Willy Tarreau <w@....eu>
To: david.laight.linux@...il.com
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
linux-kernel@...r.kernel.org, Cheng Li <lechain@...il.com>
Subject: Re: [PATCH v2 next 04/11] tools/nolibc/printf: Output pad characters
in 16 byte chunks
On Fri, Feb 06, 2026 at 07:11:14PM +0000, david.laight.linux@...il.com wrote:
> From: David Laight <david.laight.linux@...il.com>
>
> Simple to do and saves calls to the callback function.
+20 bytes here but OK for me.
> Signed-off-by: David Laight <david.laight.linux@...il.com>
Acked-by: Willy Tarreau <w@....eu>
> ---
>
> Changes for v2:
> Formally patch 3, unchanged.
>
> tools/include/nolibc/stdio.h | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/include/nolibc/stdio.h b/tools/include/nolibc/stdio.h
> index 552f09d51d82..c044a6b3babe 100644
> --- a/tools/include/nolibc/stdio.h
> +++ b/tools/include/nolibc/stdio.h
> @@ -355,10 +355,12 @@ int __nolibc_printf(__nolibc_printf_cb cb, void *state, const char *fmt, va_list
> outstr = fmt;
> len = ofs - 1;
> flush_str:
> - while (width-- > len) {
> - if (cb(state, " ", 1) != 0)
> + while (width > len) {
> + unsigned int pad_len = ((width - len - 1) & 15) + 1;
> + width -= pad_len;
> + written += pad_len;
> + if (cb(state, " ", pad_len) != 0)
> return -1;
> - written += 1;
> }
> if (cb(state, outstr, len) != 0)
> return -1;
Willy
Powered by blists - more mailing lists