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

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

 



On Thu, Feb 24, 2011 at 3:26 PM, Jeff King <peff@xxxxxxxx> wrote:
> va_copy is C99. Prior to this, the usual procedure was to
> simply copy the va_list by assignment.
>
> Signed-off-by: Jeff King <peff@xxxxxxxx>
> ---
> 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
> +

Wouldn't it be even more portable to fall back on use __va_copy (if
present), as suggested by Junio in
<7vbpip86q5.fsf@xxxxxxxxxxxxxxxxxxxxxxxx>? He also suggested using
memcpy instead of assignment in the same e-mail, due to a
recommendation in the Autoconf manual.

There's already a va_copy fall-back in compat/msvc.h, perhaps this
should be removed?
--
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]