Re: [PATCH v2 11/18] git-compat-util.h: introduce `u32_add()`
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Feb 24, 2026, 18:53 UTC
- Message-ID
- <aZ3zq0QEd8LeBxUG@nand.local>
- In-Reply-To
- <20260223134935.GA271392@coredump.intra.peff.net>
On Mon, Feb 23, 2026 at 08:49:35AM -0500, Jeff King wrote:
Show 12 quoted lines
> I am to blame for the crappy interface of the st_add() etc functions. It > did make conversion _much_ easier, because you can do stuff like: > > -foo = malloc(nr * size); > +foo = malloc(st_mult(nr, size)); > > as opposed to: > > size_t total; > ... > st_mult(&total, nr, size)); > foo = malloc(total);
Yeah, I agree that the latter is far less readable and more verbose than the former. I think that your reasoning about why it's OK to just die() here
> My rationale was that size_t computations like this are OK to die() with > very little useful error reporting up the chain because:
All very sensible.
Thanks, Taylor