git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git Mailing List <git@vger.kernel.org>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH 1/6] xdiff: drop unused mmfile parameters from xdl_do_histogram_diff()
Date: Fri, 19 Aug 2022 14:32:13 +0100	[thread overview]
Message-ID: <CAPoeCOa6BDsunamy7_GtaSy-gL_0r3kAwDJ7ffA_uiFUzhen9w@mail.gmail.com> (raw)
In-Reply-To: <Yv9OpXIQ9dYMQJ4B@coredump.intra.peff.net>

Hi Peff

On Fri, 19 Aug 2022 at 09:49, Jeff King <peff@peff.net> wrote:
>
> These are no longer used since 9df0fc3d57 (xdiff: fix a memory leak,
> 2022-02-16), as the caller is expected to call xdl_prepare_env() itself.
> After that change the histogram code only examines the prepared
> xdfenv_t, not the original buffers.

Thanks, I seem to have a blind spot for unused parameters (I think
this is at least the third such fix from you for one of my commits),
I'm really looking forward to having -Wunused-parameter enabled,
thanks for working on it. Looking at the xpatience.c I think we can
remove the mmfile_t parameters there as well, they are only end up
being used because patience_diff() gets called recursively. I'm about
to go off list for a week, but I can look at putting a patch together
for that when I get back unless you want to.

Best Wishes

Phillip

>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  xdiff/xdiffi.c     | 2 +-
>  xdiff/xdiffi.h     | 3 +--
>  xdiff/xhistogram.c | 3 +--
>  3 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/xdiff/xdiffi.c b/xdiff/xdiffi.c
> index 53e803e6bc..8c64519eac 100644
> --- a/xdiff/xdiffi.c
> +++ b/xdiff/xdiffi.c
> @@ -326,7 +326,7 @@ int xdl_do_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
>         }
>
>         if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF) {
> -               res = xdl_do_histogram_diff(mf1, mf2, xpp, xe);
> +               res = xdl_do_histogram_diff(xpp, xe);
>                 goto out;
>         }
>
> diff --git a/xdiff/xdiffi.h b/xdiff/xdiffi.h
> index 8f1c7c8b04..9d988e0263 100644
> --- a/xdiff/xdiffi.h
> +++ b/xdiff/xdiffi.h
> @@ -58,7 +58,6 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
>                   xdemitconf_t const *xecfg);
>  int xdl_do_patience_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
>                 xdfenv_t *env);
> -int xdl_do_histogram_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
> -               xdfenv_t *env);
> +int xdl_do_histogram_diff(xpparam_t const *xpp, xdfenv_t *env);
>
>  #endif /* #if !defined(XDIFFI_H) */
> diff --git a/xdiff/xhistogram.c b/xdiff/xhistogram.c
> index df909004c1..16a8fe2f3f 100644
> --- a/xdiff/xhistogram.c
> +++ b/xdiff/xhistogram.c
> @@ -362,8 +362,7 @@ static int histogram_diff(xpparam_t const *xpp, xdfenv_t *env,
>         return result;
>  }
>
> -int xdl_do_histogram_diff(mmfile_t *file1, mmfile_t *file2,
> -       xpparam_t const *xpp, xdfenv_t *env)
> +int xdl_do_histogram_diff(xpparam_t const *xpp, xdfenv_t *env)
>  {
>         return histogram_diff(xpp, env,
>                 env->xdf1.dstart + 1, env->xdf1.dend - env->xdf1.dstart + 1,
> --
> 2.37.2.928.g0821088f4a
>

  reply	other threads:[~2022-08-19 13:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19  8:48 [PATCH 0/6] unused function parameter potpourri Jeff King
2022-08-19  8:49 ` [PATCH 1/6] xdiff: drop unused mmfile parameters from xdl_do_histogram_diff() Jeff King
2022-08-19 13:32   ` Phillip Wood [this message]
2022-08-20  6:58     ` Jeff King
2022-08-20  7:36       ` [PATCH 7/6] xdiff: drop unused mmfile parameters from xdl_do_patience_diff() Jeff King
2022-08-26 13:15         ` Phillip Wood
2022-08-19  8:50 ` [PATCH 2/6] log-tree: drop unused commit param in remerge_diff() Jeff King
2022-08-19 23:05   ` Elijah Newren
2022-08-20  7:04     ` Jeff King
2022-08-19  8:50 ` [PATCH 3/6] match_pathname(): drop unused "flags" parameter Jeff King
2022-08-19  8:51 ` [PATCH 4/6] verify_one_sparse(): drop unused repository parameter Jeff King
2022-08-19 19:04   ` Derrick Stolee
2022-08-20  7:01     ` Jeff King
2022-08-20  8:48   ` René Scharfe
2022-08-20  9:02     ` [PATCH v2 " Jeff King
2022-08-19  8:54 ` [PATCH 5/6] reftable: drop unused parameter from reader_seek_linear() Jeff King
2022-08-19 19:06   ` Derrick Stolee
2022-08-22  7:46     ` Han-Wen Nienhuys
2022-08-19  8:55 ` [PATCH 6/6] reflog: assert PARSE_OPT_NONEG in parse-options callbacks Jeff King
2022-08-19 19:08 ` [PATCH 0/6] unused function parameter potpourri Derrick Stolee
2022-08-19 23:07   ` Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPoeCOa6BDsunamy7_GtaSy-gL_0r3kAwDJ7ffA_uiFUzhen9w@mail.gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).