Re: [PATCH 11/15] t-hashmap: mark unused parameters in callback function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> wrote:
> 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.

Sorry, but I didn't understand why we can't drop them and just call
t_intern() instead of setup(t_intern) (I should've done that, when
writing this). By 'other setup functions', do you mean other test
functions which use setup()? I don't think it is necessary to have
uniformity in function signatures of all the test functions.

diff --git a/t/unit-tests/t-hashmap.c b/t/unit-tests/t-hashmap.c
index 09a48c2c4e..83b79dff39 100644
--- a/t/unit-tests/t-hashmap.c
+++ b/t/unit-tests/t-hashmap.c
@@ -322,7 +322,7 @@ 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(void)
 {
 	const char *values[] = { "value1", "Value1", "value2", "value2" };
 
@@ -356,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();
 }

Thanks.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux