t-strvec: mark variable-arg helper with LAST_ARG_MUST_BE_NULL
This will let the compiler catch a problem like: /* oops, we forgot the NULL */ check_strvec(&vec, "foo"); rather than triggering undefined behavior at runtime. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
May 30, 2024 at 02:39 UTC
34eb843721bb3cd54e5fd1689d8f62bbba619bd9
1 file changed
+1
t/unit-tests/t-strvec.c
+1
@@ -4,6 +4,7 @@
4
5
#define check_strvec(vec, ...) \
6
check_strvec_loc(TEST_LOCATION(), vec, __VA_ARGS__)
7
+LAST_ARG_MUST_BE_NULL
8
static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
9
{
10
va_list ap;