]> git.ipfire.org Git - thirdparty/git.git/commitdiff
compat: provide a fallback va_copy definition
authorJeff King <peff@peff.net>
Sat, 26 Feb 2011 05:08:25 +0000 (23:08 -0600)
committerJunio C Hamano <gitster@pobox.com>
Sat, 26 Feb 2011 09:06:50 +0000 (01:06 -0800)
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>
compat/msvc.h
git-compat-util.h

index 023aba0238c844f79f2662a4b885058acbfc91fd..a33b01c032b1ab948d87b29447ad0787c86f14f1 100644 (file)
@@ -9,7 +9,6 @@
 #define inline __inline
 #define __inline__ __inline
 #define __attribute__(x)
-#define va_copy(dst, src)     ((dst) = (src))
 #define strncasecmp  _strnicmp
 #define ftruncate    _chsize
 
index 9c23622ed5ee9b60d40921ae74dd1149e1d68b8c..00d41e4f0e9c2356427f38abec317fac8fa452a4 100644 (file)
@@ -535,6 +535,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
 #define fstat_is_reliable() 1
 #endif
 
+#ifndef va_copy
+#define va_copy(dst,src) (dst) = (src)
+#endif
+
 /*
  * Preserves errno, prints a message, but gives no warning for ENOENT.
  * Always returns the return value of unlink(2).