[PATCH] spl: add %z support for tiny-printf

Tom Rini trini at konsulko.com
Mon Feb 14 16:52:35 CET 2022


On Mon, Feb 14, 2022 at 08:04:35PM +0800, Du Huanpeng wrote:

> the %zx format are used in spl from files below:
>   lib/lzma/LzmaTools.c
>   common/malloc_simple.c
> 
> it results output like "... 0xx", "size=x" output,
> treat '%z' as '%l' to support `ssize_t' type.
> 
> Signed-off-by: Du Huanpeng <dhu at hodcarrier.org>
> ---
>  lib/tiny-printf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
> index 8fc7e48..4b65f72 100644
> --- a/lib/tiny-printf.c
> +++ b/lib/tiny-printf.c
> @@ -228,7 +228,7 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
>  					ch = *fmt++;
>  				}
>  			}
> -			if (ch == 'l') {
> +			if (ch == 'l' || ch == 'z') {
>  				ch = *(fmt++);
>  				islong = true;
>  			}

Generally, we try and change code rather than add more support to
tiny-printf as it's supposed to stay as tiny as possible.  See 
eebcdb34d061 ("malloc_simple: Remove usage of unsupported %zx format
string") for a recent example.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220214/55954081/attachment.sig>


More information about the U-Boot mailing list