Re: [PATCH] [Outreachy] patch-ids: fix const correctness
- From
- Okhuomon Ajayi <okhuomonajayi54@gmail.com>
- Date
- Oct 13, 2025, 18:14 UTC
- Message-ID
- <CAFpMFfAHA8OfVXKVVSSAQ5p+B8ngT3p54on1HpM+n2qs3P1rHA@mail.gmail.com>
- In-Reply-To
- <xmqqzf9u1zix.fsf@gitster.g>
Hi Junio,
Thanks for explaining! I get it now the NEEDSWORK comment isn’t needed since the hashmap API is supposed to have cmpfn_data as const. I’ve removed the comment and didn’t change anything else
Cheers
On Mon, Oct 13, 2025 at 6:29 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 23 quoted lines
> > Okhuomon Ajayi <okhuomonajayi54@gmail.com> writes: > > > I’ll revert my local change, run a build and tests, and then think > > about safer alternatives (or leave the NEEDSWORK comment in place if > > changing the hashmap API isn’t appropriate). > > Thanks for the clarification. > > If you can convince readers that changing the hashmap API is not > appropriate, then I would think that would make a great explanation > for a commit that removes the needswork comment without doing > anything else. "Thinking about const correctness issues around this > code is no longer needed. The hashmap API is right to insist that > the extra data pointer must be const because .... Which makes > casting constness away when assigning it to opt, which is what the > code is, is indeed the only reasonable thing to do, and there is no > more change necessary around here." Of course, such a commit log > message must fill in the "because ..." part with a convincing > argument ;-). > > Thanks. > >