Re: [PATCH v2 2/6] string-list: introduce `string_list_setlen()`
- From
Jeff King <peff@peff.net>
- Date
- Apr 22, 2023, 11:14 UTC
- Message-ID
- <20230422111433.GC2969939@coredump.intra.peff.net>
- In-Reply-To
- <2a20ad8bc5513aae912c53a294092ee5087e1873.1681845518.git.me@ttaylorr.com>
On Tue, Apr 18, 2023 at 03:18:46PM -0400, Taylor Blau wrote:
Show 6 quoted lines
> This allows `string_list_split_in_place()` to overwrite any existing > entries without needing to free and re-allocate them. > > However, setting `list->nr` manually is not safe in all instances. There > are a couple of cases worth worrying about: > [...]
Thanks for adding this patch. Your explanation very nicely covers why this is a reasonable pattern, and what pitfalls we're worried about by doing it inline.
> Co-authored-by: Jeff King <peff@peff.net> > Signed-off-by: Jeff King <peff@peff.net>
Acking my forged sign-off. :)
-Peff