Thread (26 messages) flat view 26 messages, 7 authors, 2016-06-15
STALE3733d

[RFC/PATCH 1/8] compat: provide a fallback va_copy definition

From: Jeff King <hidden>
Date: 2016-06-15 22:50:39
Subsystem: the rest · Maintainer: Linus Torvalds

va_copy is C99. Prior to this, the usual procedure was to
simply copy the va_list by assignment.

Signed-off-by: Jeff King <redacted>
---
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. I couldn't find any
mention of any other alternatives.

So my guess is that this will be sufficient, but I we won't really know
for sure until somebody reports a problem. :(

 git-compat-util.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index 9c23622..00d41e4 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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).
-- 
1.7.2.5.25.g3bb93
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help