[PATCH v12 04/10] ref_tracker: have callers pass output function to pr_ostream()
Krzysztof Karas
krzysztof.karas at intel.com
Fri May 30 11:13:08 UTC 2025
Hi Jeff,
[...]
> +static void __ostream_printf pr_ostream_buf(struct ostream *stream, char *fmt, ...)
> +{
> + int ret, len = stream->size - stream->used;
> + va_list args;
> +
> + va_start(args, fmt);
> + ret = vsnprintf(stream->buf + stream->used, len, fmt, args);
vsnprintf() technically may return a negative error code.
In that case, we'd be adding some unwanted values to the
stream->used. When we encounter an error we could skip
modifying that field.
> + va_end(args);
> + stream->used += min(ret, len);
> +}
> +
[...]
Best Regardsm
Krzysztof
More information about the Intel-gfx
mailing list