Subject: Re: [PATCH 1/9] trace2: introduce function to trace unsigned integers

From: Taylor Blau <[email-masked]>
Date: Mon, 4 Aug 2025 17:33:39 -0400

On Mon, Aug 04, 2025 at 10:17:17AM +0200, Patrick Steinhardt wrote:
> While we have `trace2_data_intmax()`, there is no equivalent function
> that takes an unsigned integer. Introduce `trace2_data_uintmax()` to
> plug this gap.
>
> This function will be used in a subsequent commit.
>
> Signed-off-by: Patrick Steinhardt <[email-masked]>
> ---
>  trace2.c | 14 ++++++++++++++
>  trace2.h |  9 +++++++++
>  2 files changed, 23 insertions(+)
>
> diff --git a/trace2.c b/trace2.c
> index c23c0a227b..a687944f7b 100644
> --- a/trace2.c
> +++ b/trace2.c
> @@ -948,6 +948,20 @@ void trace2_data_intmax_fl(const char *file, int line, const char *category,
>  	strbuf_release(&buf_string);
>  }
>
> +void trace2_data_uintmax_fl(const char *file, int line, const char *category,
> +			    const struct repository *repo, const char *key,
> +			    uintmax_t value)
> +{
> +	struct strbuf buf_string = STRBUF_INIT;
> +
> +	if (!trace2_enabled)
> +		return;
> +
> +	strbuf_addf(&buf_string, "%" PRIuMAX, value);
> +	trace2_data_string_fl(file, line, category, repo, key, buf_string.buf);
> +	strbuf_release(&buf_string);
> +}
> +

Looks like a faithful copy of its signed counterpart above, which is
good. We *could* use a macro for this, but I don't think we *should*
;-).

Thanks,
Taylor