git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>
Subject: [PATCH 1/5] compat: provide a fallback va_copy definition
Date: Fri, 25 Feb 2011 23:08:25 -0600	[thread overview]
Message-ID: <20110226050825.GA27887@elie> (raw)
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

  reply	other threads:[~2011-02-26  5:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-26  5:07 [PATCH/RFC 0/5] status, commit: separate "# " from the translatable part of output Jonathan Nieder
2011-02-26  5:08 ` Jonathan Nieder [this message]
2011-02-26  5:08 ` [PATCH 2/5] strbuf: add strbuf_vaddf Jonathan Nieder
2011-02-26  5:09 ` [PATCH 3/5] wt-status: add helpers for printing wt-status lines Jonathan Nieder
2011-02-26  5:10 ` [PATCH 4/5] commit: refer to commit template as s->fp Jonathan Nieder
2011-02-26  5:11 ` [PATCH 5/5] commit, status: use status_printf{,_ln,_more} helpers Jonathan Nieder
2011-02-27  9:11   ` Junio C Hamano
2011-02-27  9:50     ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110226050825.GA27887@elie \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).