Skip to content

Commit

Permalink
compat: provide a fallback va_copy definition
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Feb 26, 2011
1 parent 046613c commit ab8632a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion compat/msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit ab8632a

Please sign in to comment.