git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Ghanshyam Thakkar <shyamthakkar001@gmail.com>,  git@vger.kernel.org
Subject: Re: What's cooking in git.git (Aug 2024, #07; Mon, 19)
Date: Tue, 20 Aug 2024 08:00:12 -0700	[thread overview]
Message-ID: <xmqq1q2jck8z.fsf@gitster.g> (raw)
In-Reply-To: <20240820051819.GA3020004@coredump.intra.peff.net> (Jeff King's message of "Tue, 20 Aug 2024 01:18:19 -0400")

Jeff King <peff@peff.net> writes:

> I did have one fixup for this series, based on feedback from Ghanshyam.
> Here it is as a separate patch on top.

Ah, I recall seeing it.  

My personal take was that calling this one via the same setup()
wrapper was just fine, which made it similar to everybody else.

But I am also fine to treat the first parameter to TEST() as just a
simple Boolean, which is the right way to think about it anyway ;-)
It is mere a happenstance that all others use the setup() thing
because they happen to share the need to perform the same set-up.

Will queue on top.  Thanks.

> -- >8 --
> Subject: [PATCH] t-hashmap: stop calling setup() for t_intern() test
>
> Commit f24a9b78a9 (t-hashmap: mark unused parameters in callback
> function, 2024-08-17) noted that the t_intern() does not need its
> hashmap parameter, but we have to keep it to conform to the function
> pointer interface of setup().
>
> But since the only thing setup() does is create and tear down the
> hashmap, we can just skip calling setup() entirely for this case, and
> drop the unused parameters. This simplifies the code a bit.
>
> Helped-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  t/unit-tests/t-hashmap.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/t/unit-tests/t-hashmap.c b/t/unit-tests/t-hashmap.c
> index da102eb541..83b79dff39 100644
> --- a/t/unit-tests/t-hashmap.c
> +++ b/t/unit-tests/t-hashmap.c
> @@ -322,8 +322,7 @@ static void t_alloc(struct hashmap *map, unsigned int ignore_case)
>  	free(removed);
>  }
>  
> -static void t_intern(struct hashmap *map UNUSED,
> -		     unsigned int ignore_case UNUSED)
> +static void t_intern(void)
>  {
>  	const char *values[] = { "value1", "Value1", "value2", "value2" };
>  
> @@ -357,6 +356,6 @@ int cmd_main(int argc UNUSED, const char **argv UNUSED)
>  	TEST(setup(t_iterate, 0), "iterate works");
>  	TEST(setup(t_iterate, 1), "iterate (case insensitive) works");
>  	TEST(setup(t_alloc, 0), "grow / shrink works");
> -	TEST(setup(t_intern, 0), "string interning works");
> +	TEST(t_intern(), "string interning works");
>  	return test_done();
>  }

      reply	other threads:[~2024-08-20 15:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  0:51 What's cooking in git.git (Aug 2024, #07; Mon, 19) Junio C Hamano
2024-08-20  5:18 ` Jeff King
2024-08-20 15:00   ` Junio C Hamano [this message]

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=xmqq1q2jck8z.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=shyamthakkar001@gmail.com \
    /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).