All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Cleanly redefine (v)snprintf when needed.
@ 2014-01-31  6:25 Benoit Sigoure
  2014-01-31 17:28 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Benoit Sigoure @ 2014-01-31  6:25 UTC (permalink / raw)
  To: git; +Cc: Benoit Sigoure

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'.
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Cleanly redefine (v)snprintf when needed.
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2014-01-31 17:28 UTC (permalink / raw)
  To: Benoit Sigoure; +Cc: git

Benoit Sigoure <tsunanet@gmail.com> writes:

> 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'.
> ---

Makes perfect sense.  Please sign-off your patch (see
Documentation/SubmittingPatches).

Thanks.

>  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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Cleanly redefine (v)snprintf when needed.
  2014-01-31 17:28 ` Junio C Hamano
@ 2014-01-31 17:36   ` Benoit Sigoure
  0 siblings, 0 replies; 3+ messages in thread
From: Benoit Sigoure @ 2014-01-31 17:36 UTC (permalink / raw)
  To: git; +Cc: gitster, Benoit Sigoure

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-31 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.