threads / patch / 64287

patch[Outreachy] patch-ids: fix const correctness

Subject: [PATCH] [Outreachy] patch-ids: fix const correctness

## tl;dr

6 messages between Oct 9, 2025 and Oct 10, 2025. Diffs are folded; open one to read it.

replies: 5people: 4as markdown or json

Okhuomon Ajayi· Oct 9, 2025, 21:44 UTC · lore
Fix const correctness warning in patch_id_neq() in patch-ids.c.
---
 patch-ids.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to patch-ids.c +1 −1
diff --git a/patch-ids.c b/patch-ids.c
index a5683b462c..4a72c2cbe6 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -42,7 +42,7 @@ static int patch_id_neq(const void *cmpfn_data,
 			const void *keydata UNUSED)
 {
 	/* NEEDSWORK: const correctness? */
-	struct diff_options *opt = (void *)cmpfn_data;
+	const struct diff_options *opt = (void *)cmpfn_data;
 	struct patch_id *a, *b;
 
 	a = container_of(eptr, struct patch_id, ent);
-- 
2.43.0
Kristoffer Haugsbakk· Oct 9, 2025, 21:46 UTC · re: Okhuomon Ajayi · lore

Re: [PATCH] [Outreachy] patch-ids: fix const correctness

On Thu, Oct 9, 2025, at 23:44, Okhuomon Ajayi wrote:
Show 20 quoted lines
> Fix const correctness warning in patch_id_neq() in patch-ids.c.
> ---
>  patch-ids.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/patch-ids.c b/patch-ids.c
> index a5683b462c..4a72c2cbe6 100644
> --- a/patch-ids.c
> +++ b/patch-ids.c
> @@ -42,7 +42,7 @@ static int patch_id_neq(const void *cmpfn_data,
>  			const void *keydata UNUSED)
>  {
>  	/* NEEDSWORK: const correctness? */
> -	struct diff_options *opt = (void *)cmpfn_data;
> +	const struct diff_options *opt = (void *)cmpfn_data;
>  	struct patch_id *a, *b;
> 
>  	a = container_of(eptr, struct patch_id, ent);
> -- 
> 2.43.0
Can’t the comment be removed now, though? If the cmit msg. says “Fix”.
Junio C Hamano· Oct 10, 2025, 00:45 UTC · re: Kristoffer Haugsbakk · lore

Re: [PATCH] [Outreachy] patch-ids: fix const correctness

"Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
Show 23 quoted lines
> On Thu, Oct 9, 2025, at 23:44, Okhuomon Ajayi wrote:
>> Fix const correctness warning in patch_id_neq() in patch-ids.c.
>> ---
>>  patch-ids.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/patch-ids.c b/patch-ids.c
>> index a5683b462c..4a72c2cbe6 100644
>> --- a/patch-ids.c
>> +++ b/patch-ids.c
>> @@ -42,7 +42,7 @@ static int patch_id_neq(const void *cmpfn_data,
>>  			const void *keydata UNUSED)
>>  {
>>  	/* NEEDSWORK: const correctness? */
>> -	struct diff_options *opt = (void *)cmpfn_data;
>> +	const struct diff_options *opt = (void *)cmpfn_data;
>>  	struct patch_id *a, *b;
>> 
>>  	a = container_of(eptr, struct patch_id, ent);
>> -- 
>> 2.43.0
>
> Can’t the comment be removed now, though? If the cmit msg. says “Fix”.

And the proposed commit log message should describe what the problem is, why it matters, and how the updated code is better than the current state of the code.

Okhuomon Ajayi· Oct 9, 2025, 21:57 UTC · re: Okhuomon Ajayi · lore
Fix const correctness warning in patch_id_neq() in patch-ids.c.
Changes in v2:
- Removed NEEDSWORK comment
---
 patch-ids.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to patch-ids.c +2 −2
diff --git a/patch-ids.c b/patch-ids.c
index a5683b462c..b6b808332f 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -41,8 +41,8 @@ static int patch_id_neq(const void *cmpfn_data,
 			const struct hashmap_entry *entry_or_key,
 			const void *keydata UNUSED)
 {
-	/* NEEDSWORK: const correctness? */
-	struct diff_options *opt = (void *)cmpfn_data;
+	
+	const struct diff_options *opt = (void *)cmpfn_data;
 	struct patch_id *a, *b;
 
 	a = container_of(eptr, struct patch_id, ent);
-- 
2.43.0
Agatha Isabelle· Oct 9, 2025, 23:49 UTC · re: Okhuomon Ajayi · lore

Re: [PATCH] [Outreachy] patch-ids: fix const correctness

Hello!
Nice patch!

One detail I would add, though, I think the correct way to submit a v2 patch is to prefix it with the `[PATCH v2]` prefix.

See: https://git-scm.com/docs/SubmittingPatches https://git-scm.com/docs/MyFirstContribution

On Thu, Oct 09, 2025 at 10:57:20PM +0100, Okhuomon Ajayi wrote:
> Fix const correctness warning in patch_id_neq() in patch-ids.c.
> 
Before the changes, I think there must be the `Signed-off-by:` line.
> Changes in v2:
> - Removed NEEDSWORK comment

And this part of the message, the changelog, I think it's supposed to be in the email message but not as part of the commit log.

Show 22 quoted lines
> ---
>  patch-ids.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/patch-ids.c b/patch-ids.c
> index a5683b462c..b6b808332f 100644
> --- a/patch-ids.c
> +++ b/patch-ids.c
> @@ -41,8 +41,8 @@ static int patch_id_neq(const void *cmpfn_data,
>  			const struct hashmap_entry *entry_or_key,
>  			const void *keydata UNUSED)
>  {
> -	/* NEEDSWORK: const correctness? */
> -	struct diff_options *opt = (void *)cmpfn_data;
> +	
> +	const struct diff_options *opt = (void *)cmpfn_data;
>  	struct patch_id *a, *b;
>  
>  	a = container_of(eptr, struct patch_id, ent);
> -- 
> 2.43.0
> 
I hope it was helpful.

Best, Ágatha Isabelle

Okhuomon Ajayi· Oct 10, 2025, 00:13 UTC · re: Agatha Isabelle · lore

Re: [PATCH] [Outreachy] patch-ids: fix const correctness

Thank you Agatha
On Fri, Oct 10, 2025 at 12:49 AM Agatha Isabelle <code@agatha.dev> wrote:
Show 51 quoted lines
>
> Hello!
>
> Nice patch!
>
> One detail I would add, though, I think the correct way to submit a v2
> patch is to prefix it with the `[PATCH v2]` prefix.
>
> See:
> https://git-scm.com/docs/SubmittingPatches
> https://git-scm.com/docs/MyFirstContribution
>
> On Thu, Oct 09, 2025 at 10:57:20PM +0100, Okhuomon Ajayi wrote:
> > Fix const correctness warning in patch_id_neq() in patch-ids.c.
> >
>
> Before the changes, I think there must be the `Signed-off-by:` line.
>
> > Changes in v2:
> > - Removed NEEDSWORK comment
>
> And this part of the message, the changelog, I think it's supposed to be
> in the email message but not as part of the commit log.
>
> > ---
> >  patch-ids.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/patch-ids.c b/patch-ids.c
> > index a5683b462c..b6b808332f 100644
> > --- a/patch-ids.c
> > +++ b/patch-ids.c
> > @@ -41,8 +41,8 @@ static int patch_id_neq(const void *cmpfn_data,
> >                       const struct hashmap_entry *entry_or_key,
> >                       const void *keydata UNUSED)
> >  {
> > -     /* NEEDSWORK: const correctness? */
> > -     struct diff_options *opt = (void *)cmpfn_data;
> > +
> > +     const struct diff_options *opt = (void *)cmpfn_data;
> >       struct patch_id *a, *b;
> >
> >       a = container_of(eptr, struct patch_id, ent);
> > --
> > 2.43.0
> >
>
> I hope it was helpful.
>
> Best,
> Ágatha Isabelle

← back to recent threads