From f24a9b78a90b333f6857a371be14fd3ee9842add Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 17 Aug 2024 04:24:47 -0400 Subject: t-hashmap: mark unused parameters in callback function The t_intern() setup function doesn't operate on a hashmap, so it ignores its parameters. But we can't drop them since it is passed as a pointer to setup(), so we have to match the other setup functions. Mark them to silence -Wunused-parameter. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/unit-tests/t-hashmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't/unit-tests/t-hashmap.c') diff --git a/t/unit-tests/t-hashmap.c b/t/unit-tests/t-hashmap.c index 09a48c2c4e..da102eb541 100644 --- a/t/unit-tests/t-hashmap.c +++ b/t/unit-tests/t-hashmap.c @@ -322,7 +322,8 @@ static void t_alloc(struct hashmap *map, unsigned int ignore_case) free(removed); } -static void t_intern(struct hashmap *map, unsigned int ignore_case) +static void t_intern(struct hashmap *map UNUSED, + unsigned int ignore_case UNUSED) { const char *values[] = { "value1", "Value1", "value2", "value2" }; -- cgit v1.2.3 From a6bcb3ca010ed47d26dfa5d5d221f91a46887c2f Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 20 Aug 2024 01:18:19 -0400 Subject: 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 Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/unit-tests/t-hashmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 't/unit-tests/t-hashmap.c') 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(); } -- cgit v1.2.3