test-hashmap: simplify alloc_test_entry
authorJeff King <peff@peff.net>
Wed, 14 Feb 2018 18:08:20 +0000 (13:08 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Feb 2018 18:31:10 +0000 (10:31 -0800)
commit7daa825d677dcbd40724cb146f3949b7d574e8b3
treeacd7bcab8da32bc3a76a4ddd350da3bedaa17584
parent7e8089c986790fd8ef9d89bf71c9a91901d7f884
test-hashmap: simplify alloc_test_entry

This function takes two ptr/len pairs, which implies that
they can be arbitrary buffers. But internally, it assumes
that each "ptr" is NUL-terminated at "len" (because we
memcpy an extra byte to pick up the NUL terminator).

In practice this works because each caller only ever passes
strlen(ptr) as the length. But let's drop the "len"
parameters to make our expectations clear.

Note that we can get rid of the "l1" and "l2" variables from
cmd_main() as a further cleanup, since they are now mostly
used to check whether the p1 and p2 arguments are present
(technically the length parameters conflated NULL with the
empty string, which we no longer do, but I think that is
actually an improvement).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-hashmap.c