{"thread":{"id":"56222","subject":"[PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()","startedAt":"2021-08-05T20:47:57Z","lastAt":"2021-08-09T15:17:45Z","messageCount":3,"participants":["Jeff King","Junio C Hamano","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"432137","messageId":"YQxOevw7Q+NYX2YF@coredump.intra.peff.net","threadId":"56222","inReplyTo":null,"subject":"[PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-08-05T20:47:54Z","receivedAt":"2021-08-05T20:47:57Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When 8e809cbb2f (diff --color-moved-ws=allow-indentation-change:\nsimplify and optimize, 2021-07-20) stopped looking at o->emitted_symbols\nand instead took the symbol as a parameter, we no longer need to look at\nthe diff_options struct at all.\n\nDropping the unused parameter makes it clear that the function is\nindependent of the diff options.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nJust a small cleanup on top of pw/diff-color-moved-fix, which is now in\n'next'. I noticed due to my -Wunused-parameters patches (which one day\nI'll finally clean up enough to send to the list).\n\n diff.c | 5 ++---\n 1 file changed, 2 insertions(+), 3 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 2956c8f710..164af13b4f 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -863,8 +863,7 @@ static int compute_ws_delta(const struct emitted_diff_symbol *a,\n \treturn a_width - b_width;\n }\n \n-static int cmp_in_block_with_wsd(const struct diff_options *o,\n-\t\t\t\t const struct moved_entry *cur,\n+static int cmp_in_block_with_wsd(const struct moved_entry *cur,\n \t\t\t\t const struct emitted_diff_symbol *l,\n \t\t\t\t struct moved_block *pmb)\n {\n@@ -1016,7 +1015,7 @@ static void pmb_advance_or_null(struct diff_options *o,\n \t\tif (o->color_moved_ws_handling &\n \t\t    COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE)\n \t\t\tmatch = cur &&\n-\t\t\t\t!cmp_in_block_with_wsd(o, cur, l, &pmb[i]);\n+\t\t\t\t!cmp_in_block_with_wsd(cur, l, &pmb[i]);\n \t\telse\n \t\t\tmatch = cur && cur->es->id == l->id;\n \n-- \n2.33.0.rc0.523.g07fb5e6bbb\n"},{"id":"432139","messageId":"xmqqa6lvk0jf.fsf@gitster.g","threadId":"56222","inReplyTo":"YQxOevw7Q+NYX2YF@coredump.intra.peff.net","subject":"Re: [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-08-05T22:08:04Z","receivedAt":"2021-08-05T22:08:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> When 8e809cbb2f (diff --color-moved-ws=allow-indentation-change:\n> simplify and optimize, 2021-07-20) stopped looking at o->emitted_symbols\n> and instead took the symbol as a parameter, we no longer need to look at\n> the diff_options struct at all.\n>\n> Dropping the unused parameter makes it clear that the function is\n> independent of the diff options.\n>\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> Just a small cleanup on top of pw/diff-color-moved-fix, which is now in\n> 'next'. I noticed due to my -Wunused-parameters patches (which one day\n> I'll finally clean up enough to send to the list).\n\nNice.\n\n>\n>  diff.c | 5 ++---\n>  1 file changed, 2 insertions(+), 3 deletions(-)\n>\n> diff --git a/diff.c b/diff.c\n> index 2956c8f710..164af13b4f 100644\n> --- a/diff.c\n> +++ b/diff.c\n> @@ -863,8 +863,7 @@ static int compute_ws_delta(const struct emitted_diff_symbol *a,\n>  \treturn a_width - b_width;\n>  }\n>  \n> -static int cmp_in_block_with_wsd(const struct diff_options *o,\n> -\t\t\t\t const struct moved_entry *cur,\n> +static int cmp_in_block_with_wsd(const struct moved_entry *cur,\n>  \t\t\t\t const struct emitted_diff_symbol *l,\n>  \t\t\t\t struct moved_block *pmb)\n>  {\n> @@ -1016,7 +1015,7 @@ static void pmb_advance_or_null(struct diff_options *o,\n>  \t\tif (o->color_moved_ws_handling &\n>  \t\t    COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE)\n>  \t\t\tmatch = cur &&\n> -\t\t\t\t!cmp_in_block_with_wsd(o, cur, l, &pmb[i]);\n> +\t\t\t\t!cmp_in_block_with_wsd(cur, l, &pmb[i]);\n>  \t\telse\n>  \t\t\tmatch = cur && cur->es->id == l->id;\n"},{"id":"432305","messageId":"ecb2961f-090e-aa84-4180-65ab43c8920d@gmail.com","threadId":"56222","inReplyTo":"YQxOevw7Q+NYX2YF@coredump.intra.peff.net","subject":"Re: [PATCH] diff: drop unused options parameter from cmp_in_block_with_wsd()","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2021-08-09T15:17:39Z","receivedAt":"2021-08-09T15:17:45Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 05/08/2021 21:47, Jeff King wrote:\n> When 8e809cbb2f (diff --color-moved-ws=allow-indentation-change:\n> simplify and optimize, 2021-07-20) stopped looking at o->emitted_symbols\n> and instead took the symbol as a parameter, we no longer need to look at\n> the diff_options struct at all.\n> \n> Dropping the unused parameter makes it clear that the function is\n> independent of the diff options.\n\nThanks Peff\n\nBest Wishes\n\nPhillip\n\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n> Just a small cleanup on top of pw/diff-color-moved-fix, which is now in\n> 'next'. I noticed due to my -Wunused-parameters patches (which one day\n> I'll finally clean up enough to send to the list).\n> \n>   diff.c | 5 ++---\n>   1 file changed, 2 insertions(+), 3 deletions(-)\n> \n> diff --git a/diff.c b/diff.c\n> index 2956c8f710..164af13b4f 100644\n> --- a/diff.c\n> +++ b/diff.c\n> @@ -863,8 +863,7 @@ static int compute_ws_delta(const struct emitted_diff_symbol *a,\n>   \treturn a_width - b_width;\n>   }\n>   \n> -static int cmp_in_block_with_wsd(const struct diff_options *o,\n> -\t\t\t\t const struct moved_entry *cur,\n> +static int cmp_in_block_with_wsd(const struct moved_entry *cur,\n>   \t\t\t\t const struct emitted_diff_symbol *l,\n>   \t\t\t\t struct moved_block *pmb)\n>   {\n> @@ -1016,7 +1015,7 @@ static void pmb_advance_or_null(struct diff_options *o,\n>   \t\tif (o->color_moved_ws_handling &\n>   \t\t    COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE)\n>   \t\t\tmatch = cur &&\n> -\t\t\t\t!cmp_in_block_with_wsd(o, cur, l, &pmb[i]);\n> +\t\t\t\t!cmp_in_block_with_wsd(cur, l, &pmb[i]);\n>   \t\telse\n>   \t\t\tmatch = cur && cur->es->id == l->id;\n>   \n> \n"}]}