]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t-hashmap: stop calling setup() for t_intern() test
authorJeff King <peff@peff.net>
Tue, 20 Aug 2024 05:18:19 +0000 (01:18 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 20 Aug 2024 15:33:18 +0000 (08:33 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-hashmap.c

index da102eb541792caca84f8b8731142b0315b9fac2..83b79dff391c1778aeb7f0e65503eba0179316ab 100644 (file)
@@ -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();
 }