Re: [PATCH v2 3/3] parseopt: values of pathname type can be prefixed with :(optional)
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Nov 3, 2025, 00:10 UTC
- Message-ID
- <CAPig+cQLri3m9398R0JEf2fafKVkZBvOdxvpg=xPF2aZ6ayDvQ@mail.gmail.com>
- In-Reply-To
- <CALnO6CC=FFuMmBfJPzunUqDOBMBtmXm3i73y9M9LgRrhxzrs9g@mail.gmail.com>
On Sun, Nov 2, 2025 at 11:20 AM D. Ben Knoble <ben.knoble+github@gmail.com> wrote:
Show 12 quoted lines
> On Tue, Sep 30, 2025 at 11:26 AM Phillip Wood <phillip.wood123@gmail.com> wrote: > > On 28/09/2025 22:29, D. Ben Knoble wrote: > > > + is_optional = skip_prefix(value, ":(optional)", &value); > > > + if (!value) > > > + is_optional = 0; > > > > I'm struggling to see how value can be NULL here as we return early if > > it NULL before calling skip_prefix() > > Doesn't the "skip_prefix" above write into value? So I think if > "value" is exactly the string ":(optional)", then after the call to > skip_prefix it points at the null terminator.
I haven't particularly been following this topic, but your response suggests that you're reading the code as if it says:
if (!*value)
is_optional = 0;whereas, Philip is reading the code as written, which lacks the `*` dereference.