Subject: Re: [PATCH 1/4] strbuf: add strbuf_add_uint()

From: Jeff King <[email-masked]>
Date: Wed, 13 May 2026 12:47:22 -0400

On Wed, May 13, 2026 at 12:22:32PM -0400, Jeff King wrote:

>  void strbuf_add_uint(struct strbuf *sb, uintmax_t value)
>  {
> -	char buf[DIV_ROUND_UP(bitsizeof(value) * 10, 33)];
> -	char *end = buf + sizeof(buf);
> -	char *p = end;
> +	unsigned digits = decimal_length_u64(value);
> +	char *p;
>  
> +	strbuf_grow(sb, digits);
> +	p = sb->buf + digits;

This last line should be "sb->buf + sb->len + digits", of course.
Naturally that was the part I wrote by hand. ;)

It doesn't matter for the cat-file test, since we're always formatting
into an empty buffer, but it does for the ls-files padding one.

-Peff