git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()
@ 2021-08-05 20:47 Jeff King
  2021-08-05 22:08 ` Junio C Hamano
  2021-08-09 15:17 ` Phillip Wood
  0 siblings, 2 replies; 3+ messages in thread
From: Jeff King @ 2021-08-05 20:47 UTC (permalink / raw)
  To: Phillip Wood; +Cc: Junio C Hamano, git

When 8e809cbb2f (diff --color-moved-ws=allow-indentation-change:
simplify and optimize, 2021-07-20) stopped looking at o->emitted_symbols
and instead took the symbol as a parameter, we no longer need to look at
the diff_options struct at all.

Dropping the unused parameter makes it clear that the function is
independent of the diff options.

Signed-off-by: Jeff King <peff@peff.net>
---
Just a small cleanup on top of pw/diff-color-moved-fix, which is now in
'next'. I noticed due to my -Wunused-parameters patches (which one day
I'll finally clean up enough to send to the list).

 diff.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/diff.c b/diff.c
index 2956c8f710..164af13b4f 100644
--- a/diff.c
+++ b/diff.c
@@ -863,8 +863,7 @@ static int compute_ws_delta(const struct emitted_diff_symbol *a,
 	return a_width - b_width;
 }
 
-static int cmp_in_block_with_wsd(const struct diff_options *o,
-				 const struct moved_entry *cur,
+static int cmp_in_block_with_wsd(const struct moved_entry *cur,
 				 const struct emitted_diff_symbol *l,
 				 struct moved_block *pmb)
 {
@@ -1016,7 +1015,7 @@ static void pmb_advance_or_null(struct diff_options *o,
 		if (o->color_moved_ws_handling &
 		    COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE)
 			match = cur &&
-				!cmp_in_block_with_wsd(o, cur, l, &pmb[i]);
+				!cmp_in_block_with_wsd(cur, l, &pmb[i]);
 		else
 			match = cur && cur->es->id == l->id;
 
-- 
2.33.0.rc0.523.g07fb5e6bbb

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()
  2021-08-05 20:47 [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd() Jeff King
@ 2021-08-05 22:08 ` Junio C Hamano
  2021-08-09 15:17 ` Phillip Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2021-08-05 22:08 UTC (permalink / raw)
  To: Jeff King; +Cc: Phillip Wood, git

Jeff King <peff@peff.net> writes:

> When 8e809cbb2f (diff --color-moved-ws=allow-indentation-change:
> simplify and optimize, 2021-07-20) stopped looking at o->emitted_symbols
> and instead took the symbol as a parameter, we no longer need to look at
> the diff_options struct at all.
>
> Dropping the unused parameter makes it clear that the function is
> independent of the diff options.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> Just a small cleanup on top of pw/diff-color-moved-fix, which is now in
> 'next'. I noticed due to my -Wunused-parameters patches (which one day
> I'll finally clean up enough to send to the list).

Nice.

>
>  diff.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/diff.c b/diff.c
> index 2956c8f710..164af13b4f 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -863,8 +863,7 @@ static int compute_ws_delta(const struct emitted_diff_symbol *a,
>  	return a_width - b_width;
>  }
>  
> -static int cmp_in_block_with_wsd(const struct diff_options *o,
> -				 const struct moved_entry *cur,
> +static int cmp_in_block_with_wsd(const struct moved_entry *cur,
>  				 const struct emitted_diff_symbol *l,
>  				 struct moved_block *pmb)
>  {
> @@ -1016,7 +1015,7 @@ static void pmb_advance_or_null(struct diff_options *o,
>  		if (o->color_moved_ws_handling &
>  		    COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE)
>  			match = cur &&
> -				!cmp_in_block_with_wsd(o, cur, l, &pmb[i]);
> +				!cmp_in_block_with_wsd(cur, l, &pmb[i]);
>  		else
>  			match = cur && cur->es->id == l->id;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()
  2021-08-05 20:47 [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd() Jeff King
  2021-08-05 22:08 ` Junio C Hamano
@ 2021-08-09 15:17 ` Phillip Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Phillip Wood @ 2021-08-09 15:17 UTC (permalink / raw)
  To: Jeff King, Phillip Wood; +Cc: Junio C Hamano, git

On 05/08/2021 21:47, Jeff King wrote:
> When 8e809cbb2f (diff --color-moved-ws=allow-indentation-change:
> simplify and optimize, 2021-07-20) stopped looking at o->emitted_symbols
> and instead took the symbol as a parameter, we no longer need to look at
> the diff_options struct at all.
> 
> Dropping the unused parameter makes it clear that the function is
> independent of the diff options.

Thanks Peff

Best Wishes

Phillip

> Signed-off-by: Jeff King <peff@peff.net>
> ---
> Just a small cleanup on top of pw/diff-color-moved-fix, which is now in
> 'next'. I noticed due to my -Wunused-parameters patches (which one day
> I'll finally clean up enough to send to the list).
> 
>   diff.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/diff.c b/diff.c
> index 2956c8f710..164af13b4f 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -863,8 +863,7 @@ static int compute_ws_delta(const struct emitted_diff_symbol *a,
>   	return a_width - b_width;
>   }
>   
> -static int cmp_in_block_with_wsd(const struct diff_options *o,
> -				 const struct moved_entry *cur,
> +static int cmp_in_block_with_wsd(const struct moved_entry *cur,
>   				 const struct emitted_diff_symbol *l,
>   				 struct moved_block *pmb)
>   {
> @@ -1016,7 +1015,7 @@ static void pmb_advance_or_null(struct diff_options *o,
>   		if (o->color_moved_ws_handling &
>   		    COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE)
>   			match = cur &&
> -				!cmp_in_block_with_wsd(o, cur, l, &pmb[i]);
> +				!cmp_in_block_with_wsd(cur, l, &pmb[i]);
>   		else
>   			match = cur && cur->es->id == l->id;
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-09 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 20:47 [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd() Jeff King
2021-08-05 22:08 ` Junio C Hamano
2021-08-09 15:17 ` Phillip Wood

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).