Skip to content

Commit ab8632a

Browse files
peffgitster
authored andcommitted
compat: provide a fallback va_copy definition
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 <[email protected]> Improved-by: Erik Faye-Lund <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 046613c commit ab8632a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compat/msvc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#define inline __inline
1010
#define __inline__ __inline
1111
#define __attribute__(x)
12-
#define va_copy(dst, src) ((dst) = (src))
1312
#define strncasecmp _strnicmp
1413
#define ftruncate _chsize
1514

git-compat-util.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@ void git_qsort(void *base, size_t nmemb, size_t size,
535535
#define fstat_is_reliable() 1
536536
#endif
537537

538+
#ifndef va_copy
539+
#define va_copy(dst,src) (dst) = (src)
540+
#endif
541+
538542
/*
539543
* Preserves errno, prints a message, but gives no warning for ENOENT.
540544
* Always returns the return value of unlink(2).

0 commit comments

Comments
 (0)