mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
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>
This commit is contained in:
parent
b639884f9a
commit
34eb843721
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#define check_strvec(vec, ...) \
|
#define check_strvec(vec, ...) \
|
||||||
check_strvec_loc(TEST_LOCATION(), vec, __VA_ARGS__)
|
check_strvec_loc(TEST_LOCATION(), vec, __VA_ARGS__)
|
||||||
|
LAST_ARG_MUST_BE_NULL
|
||||||
static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
|
static void check_strvec_loc(const char *loc, struct strvec *vec, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
Loading…
Reference in a new issue