Re: [PATCH 7/9] http: discard hash in dumb-http http_object_request
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 3, 2026, 11:27 UTC
- Message-ID
- <akecqPq4F702E8Cq@pks.im>
- In-Reply-To
- <20260702080707.GG2029434@coredump.intra.peff.net>
On Thu, Jul 02, 2026 at 04:07:07AM -0400, Jeff King wrote:
Show 7 quoted lines
> The flag handling could be removed if the hash-discard function were > idempotent. This could be done easily-ish by having the underlying > hash functions (like the ones in sha256/openssl.h) set the context > pointer to NULL after free-ing. But it's something that every platform > implementation would have to remember to do, and the benefit for the > callers is not that huge (it would let us shave a few lines here and > probably in a few other spots).
This answers an earlier question of mine. It would indeed be great if it was idempotent -- I've been bitten by interfaces like this once too much, where you have to be very careful to manage the lifetime of a specific object. The prime example of this are (were? I don't quite recall whether we fixed that interface) reference transactions, and that caused a bunch of bugs in the past.
Patrick