git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/5] compat: provide a fallback va_copy definition

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 26, 2011, 05:08 UTC
Message-ID
<20110226050825.GA27887@elie>
In-Reply-To
<20110226050723.GA27864@elie>
From: Jeff King <peff@peff.net>

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>
---
 compat/msvc.h     |    1 -
 git-compat-util.h |    4 ++++
 2 files changed, 4 insertions(+), 1 deletions(-)
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
 
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
+
 /*
  * Preserves errno, prints a message, but gives no warning for ENOENT.
  * Always returns the return value of unlink(2).
-- 
1.7.4.1
Previous: Jonathan NiederNext: Jonathan Nieder
Message 2 of 8 in “status, commit: separate "# " from the translatable part of output”
  1. 0/5 status, commit: separate "# " from the translatable part of outputJonathan Nieder, Feb 26, 2011
  2. 1/5 compat: provide a fallback va_copy definitionJonathan Nieder, Feb 26, 2011
  3. 2/5 strbuf: add strbuf_vaddfJonathan Nieder, Feb 26, 2011
  4. 3/5 wt-status: add helpers for printing wt-status linesJonathan Nieder, Feb 26, 2011
  5. 4/5 commit: refer to commit template as s->fpJonathan Nieder, Feb 26, 2011
  6. 5/5 commit, status: use status_printf{,_ln,_more} helpersJonathan Nieder, Feb 26, 2011
  7. Junio C HamanoFeb 27, 2011
  8. Jonathan NiederFeb 27, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.