Re: [PATCH v2 6/7] string-list: optionally omit empty string pieces in string_list_split*()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 1, 2025, 16:38 UTC
- Message-ID
- <xmqqzfcjm1za.fsf@gitster.g>
- In-Reply-To
- <aIx_KAhKhGedQ0mV@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
>> + if ((flags & STRING_LIST_SPLIT_NONEMPTY) && (end <= p)) >> + return 0; > > Okay, this is where the return value of `append_one()` starts to make > sense. > > The condition for `end <= p` is probably overly defensive, as it > shouldn't ever happen that `end < p`. We could make that a `BUG()`, but > I'm not sure that's really worth it.
Correct. I'd leave it to be defensive but without overly pessimistic BUG, as this is a leaf function that, once carefully vetted, is unlikely to become buggy (which is famous last words).