@matheusbsbs / matheus-bagliano / commits / ab8632ae36
Fork 0

compat: provide a fallback va_copy definition

va_copy is C99. We have avoided using va_copy many times in the past, which has led to a bunch of cut-and-paste. From everything I found searching the web, implementations have historically either provided va_copy or just let your code assume that simple assignment of worked. So my guess is that this will be sufficient, though we won't really know for sure until somebody reports a problem. Signed-off-by: Jeff King <peff@peff.net> Improved-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Feb 25, 2011 at 23:08 UTC ab8632ae36d2e5faf524309696725b60ec18e588
2 files changed +4 -1
compat/msvc.h
-1
@@ -9,7 +9,6 @@
9 #define inline __inline
10 #define __inline__ __inline
11 #define __attribute__(x)
12 -#define va_copy(dst, src) ((dst) = (src))
12 #define strncasecmp _strnicmp
13 #define ftruncate _chsize
14
git-compat-util.h
+4
@@ -535,6 +535,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
535 #define fstat_is_reliable() 1
536 #endif
537
538 +#ifndef va_copy
539 +#define va_copy(dst,src) (dst) = (src)
540 +#endif
541 +
542 /*
543 * Preserves errno, prints a message, but gives no warning for ENOENT.
544 * Always returns the return value of unlink(2).