git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benoit Sigoure <tsunanet@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Benoit Sigoure <tsunanet@gmail.com>
Subject: [PATCH] Cleanly redefine (v)snprintf when needed.
Date: Fri, 31 Jan 2014 09:36:28 -0800	[thread overview]
Message-ID: <1391189788-15130-1-git-send-email-tsunanet@gmail.com> (raw)
In-Reply-To: <xmqqy51wgiwd.fsf@gitster.dls.corp.google.com>

When we detect that vsnprintf / snprintf are broken, we #define them to
an alternative implementation.  On OS X, stdio.h already #define's them,
which causes a warning to be issued at the point we re-define them in
`git-compat-util.h'.

Signed-off-by: Benoit Sigoure <tsunanet@gmail.com>
---
 git-compat-util.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/git-compat-util.h b/git-compat-util.h
index cbd86c3..614a5e9 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -480,9 +480,15 @@ extern FILE *git_fopen(const char*, const char*);
 #endif
 
 #ifdef SNPRINTF_RETURNS_BOGUS
+#ifdef snprintf
+#undef snprintf
+#endif
 #define snprintf git_snprintf
 extern int git_snprintf(char *str, size_t maxsize,
 			const char *format, ...);
+#ifdef vsnprintf
+#undef vsnprintf
+#endif
 #define vsnprintf git_vsnprintf
 extern int git_vsnprintf(char *str, size_t maxsize,
 			 const char *format, va_list ap);
-- 
1.9.rc1.1.g186f0be.dirty

      reply	other threads:[~2014-01-31 17:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31  6:25 [PATCH] Cleanly redefine (v)snprintf when needed Benoit Sigoure
2014-01-31 17:28 ` Junio C Hamano
2014-01-31 17:36   ` Benoit Sigoure [this message]

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=1391189788-15130-1-git-send-email-tsunanet@gmail.com \
    --to=tsunanet@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).