From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.formilux.org (mta1.formilux.org [51.159.59.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5ECA1F1534 for ; Sat, 7 Feb 2026 19:38:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.59.229 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770493119; cv=none; b=np2o+4kK2yQJflmnQje4Bwb/NS33rzvMVn8FR8BNbhYcv2Jh8tvzdqlZj5KCzbKrf9/PX9qCPbaM0ryOUZnAQFdl3pPYqW6aHRLGoje6WNn0/IMtIjZu885xyH9w9x3vK/J9YS57U0gcpYz2xdaMws7MQ7DSg1NOFmYqGmnBzZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770493119; c=relaxed/simple; bh=zDfmaD9WqVqa7nlUE/anvYQZsfvL3l7e5lLkxGwW3ck=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dKsjPc48IGPYoVQ6IN9H9OcyuBWAP3+dUzOiQ7f71FF2q8X/ehVODw1eBLbBoBMFYScHuKEknTmzKm9/XOLW1G6ZdQWccND+E97aawz+3YTpfSdi1PRCLbcabl8kdIn4ELo3caF0zM8wdZwb3l159s8hXJUy6TQGzpz9cg/2Wv8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b=r+8xIUch; arc=none smtp.client-ip=51.159.59.229 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b="r+8xIUch" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1770493116; bh=ovCmrdTO25zyO0gS0K8uUVanMGH1x4yUxrIuwxZap1k=; h=From:Message-ID:From; b=r+8xIUchoj2CrsysLbjwZecbNOLDXAX1TTFvMZtm5ETdt+to7dphdzPyOhwi0uwgI BWs5tVaqEBycrl1IK2I6rBVtbJIVZbjsY282cVvDLfAW9cndRczLlcmyD4I3b3IKbl 1Hy84D9glI7CR61a1lMQlOmp9cjcG/XNB8fs4DpE= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id AF4F2C0B45; Sat, 07 Feb 2026 20:38:36 +0100 (CET) Date: Sat, 7 Feb 2026 20:38:36 +0100 From: Willy Tarreau To: david.laight.linux@gmail.com Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , linux-kernel@vger.kernel.org, Cheng Li Subject: Re: [PATCH v2 next 04/11] tools/nolibc/printf: Output pad characters in 16 byte chunks Message-ID: References: <20260206191121.3602-1-david.laight.linux@gmail.com> <20260206191121.3602-5-david.laight.linux@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260206191121.3602-5-david.laight.linux@gmail.com> On Fri, Feb 06, 2026 at 07:11:14PM +0000, david.laight.linux@gmail.com wrote: > From: David Laight > > Simple to do and saves calls to the callback function. +20 bytes here but OK for me. > Signed-off-by: David Laight Acked-by: Willy Tarreau > --- > > 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