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

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

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

Jeff King wrote:
So my guess is that this will be sufficient, but I we won't really know
for sure until somebody reports a problem. :(
Sounds like a good approach to me.

The POSIX rationale hints that some historical implementations used
arrays of size 1.  Assignment would error out on such an
implementation, which is not a big deal (since we could switch to
memcpy then).  I would be more worried about a historical
implementation using dynamic allocation with va_list being a pointer
but I haven't heard of any.
+#ifndef va_copy
+#define va_copy(dst,src) (dst) = (src)
+#endif
The following (as Erik mentinoed) might be a nice cleanup on top.  The
duplicate va_copy definition is just redundant rather than causing
compilation errors because it comes before git-compat-util's
ifndef-guarded one.
diff --git a/compat/msvc.h b/compat/msvc.h
index 023aba0..a33b01c 100644
--- a/compat/msvc.h
+++ b/compat/msvc.h
@@ -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
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help