Re: [PATCH v2 0/7] trace2: stop allowing die()
- From
Jeff King <peff@peff.net>
- Date
- Aug 27, 2026, 05:23 UTC
- Message-ID
- <20260827052318.GC176544@coredump.intra.peff.net>
- In-Reply-To
- <pull.2178.v2.git.1787684181.gitgitgadget@gmail.com>
On Tue, Aug 25, 2026 at 06:56:14PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 11 quoted lines
> This starts with a new banned-die.h header file at the root of the repo and > including it from all trace2 API *.c files. It starts empty, but the later > patches will add one method at a time: > > * xsnprintf() : This is the original patch, but made more complete by > adding the method to banned-die.h. > * xstrdup() > * ALLOC_ARRAY() > * xstrfmt() > * ALLOC_GROW() > * xcalloc()
OK. This feels like the tip of the iceberg, though. All of strbuf would have to be off-limits, too (both because it calls malloc directly, but also because it will bail if snprintf() returns -1). I won't be surprised if there are other indirect calls hiding in various places (e.g., all of json-writer.c).
I think if you really want to avoid allocations in trace2 it would probably need to be a ground-up no-dependency rewrite.
-Peff