]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t-strvec: mark variable-arg helper with LAST_ARG_MUST_BE_NULL
authorJeff King <peff@peff.net>
Thu, 30 May 2024 06:39:56 +0000 (02:39 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 May 2024 15:55:29 +0000 (08:55 -0700)
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>
t/unit-tests/t-strvec.c

index 6c1465ee610fff3b76c3e613090872e1f36bf39d..d4615ab06daefb05c33422a668e784dc95994300 100644 (file)
@@ -4,6 +4,7 @@
 
 #define check_strvec(vec, ...) \
        check_strvec_loc(TEST_LOCATION(), vec, __VA_ARGS__)
+LAST_ARG_MUST_BE_NULL
 static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
 {
        va_list ap;