git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Aug 2024, #07; Mon, 19)

From
Jeff King <peff@peff.net>
Date
Aug 20, 2024, 05:18 UTC
Message-ID
<20240820051819.GA3020004@coredump.intra.peff.net>
In-Reply-To
<xmqqa5h8c8zu.fsf@gitster.g>
On Mon, Aug 19, 2024 at 05:51:01PM -0700, Junio C Hamano wrote:
Show 22 quoted lines
> * jk/mark-unused-parameters (2024-08-17) 15 commits
>   (merged to 'next' on 2024-08-19 at f85d6096c9)
>  + scalar: mark unused parameters in dummy function
>  + daemon: mark unused parameters in non-posix fallbacks
>  + setup: mark unused parameter in config callback
>  + test-mergesort: mark unused parameters in trivial callback
>  + t-hashmap: mark unused parameters in callback function
>  + reftable: mark unused parameters in virtual functions
>  + reftable: drop obsolete test function declarations
>  + reftable: ignore unused argc/argv in test functions
>  + unit-tests: ignore unused argc/argv
>  + t/helper: mark more unused argv/argc arguments
>  + oss-fuzz: mark unused argv/argc argument
>  + refs: mark unused parameters in do_for_each_reflog_helper()
>  + refs: mark unused parameters in ref_store fsck callbacks
>  + update-ref: mark more unused parameters in parser callbacks
>  + imap-send: mark unused parameter in ssl_socket_connect() fallback
> 
>  Mark unused parameters as UNUSED to squelch -Wunused warnings.
> 
>  Will merge to 'master'.
>  source: <20240817082101.GA6761@coredump.intra.peff.net>

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

-- >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();
 }
-- 
2.46.0.584.ga7429125f1
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 3 in “What's cooking in git.git (Aug 2024, #07; Mon, 19)”
  1. Junio C HamanoAug 20, 2024
  2. Jeff KingAug 20, 2024
  3. Junio C HamanoAug 20, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.