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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]