{"thread":{"id":"35770","subject":"[PATCH] Cleanly redefine (v)snprintf when needed.","startedAt":"2014-01-31T06:25:12Z","lastAt":"2014-01-31T17:36:28Z","messageCount":3,"participants":["Benoit Sigoure","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"233970","messageId":"1391149512-8705-1-git-send-email-tsunanet@gmail.com","threadId":"35770","inReplyTo":null,"subject":"[PATCH] Cleanly redefine (v)snprintf when needed.","fromName":"Benoit Sigoure","fromEmail":"tsunanet@gmail.com","sentAt":"2014-01-31T06:25:12Z","receivedAt":"2014-01-31T06:25:12Z","isPatch":true,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"When we detect that vsnprintf / snprintf are broken, we #define them to\nan alternative implementation.  On OS X, stdio.h already #define's them,\nwhich causes a warning to be issued at the point we re-define them in\n`git-compat-util.h'.\n---\n git-compat-util.h | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex cbd86c3..614a5e9 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -480,9 +480,15 @@ extern FILE *git_fopen(const char*, const char*);\n #endif\n \n #ifdef SNPRINTF_RETURNS_BOGUS\n+#ifdef snprintf\n+#undef snprintf\n+#endif\n #define snprintf git_snprintf\n extern int git_snprintf(char *str, size_t maxsize,\n \t\t\tconst char *format, ...);\n+#ifdef vsnprintf\n+#undef vsnprintf\n+#endif\n #define vsnprintf git_vsnprintf\n extern int git_vsnprintf(char *str, size_t maxsize,\n \t\t\t const char *format, va_list ap);\n-- \n1.9.rc1.1.g186f0be.dirty\n"},{"id":"233985","messageId":"xmqqy51wgiwd.fsf@gitster.dls.corp.google.com","threadId":"35770","inReplyTo":"1391149512-8705-1-git-send-email-tsunanet@gmail.com","subject":"Re: [PATCH] Cleanly redefine (v)snprintf when needed.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-01-31T17:28:50Z","receivedAt":"2014-01-31T17:28:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Benoit Sigoure <tsunanet@gmail.com> writes:\n\n> When we detect that vsnprintf / snprintf are broken, we #define them to\n> an alternative implementation.  On OS X, stdio.h already #define's them,\n> which causes a warning to be issued at the point we re-define them in\n> `git-compat-util.h'.\n> ---\n\nMakes perfect sense.  Please sign-off your patch (see\nDocumentation/SubmittingPatches).\n\nThanks.\n\n>  git-compat-util.h | 6 ++++++\n>  1 file changed, 6 insertions(+)\n>\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index cbd86c3..614a5e9 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -480,9 +480,15 @@ extern FILE *git_fopen(const char*, const char*);\n>  #endif\n>  \n>  #ifdef SNPRINTF_RETURNS_BOGUS\n> +#ifdef snprintf\n> +#undef snprintf\n> +#endif\n>  #define snprintf git_snprintf\n>  extern int git_snprintf(char *str, size_t maxsize,\n>  \t\t\tconst char *format, ...);\n> +#ifdef vsnprintf\n> +#undef vsnprintf\n> +#endif\n>  #define vsnprintf git_vsnprintf\n>  extern int git_vsnprintf(char *str, size_t maxsize,\n>  \t\t\t const char *format, va_list ap);\n"},{"id":"233986","messageId":"1391189788-15130-1-git-send-email-tsunanet@gmail.com","threadId":"35770","inReplyTo":"xmqqy51wgiwd.fsf@gitster.dls.corp.google.com","subject":"[PATCH] Cleanly redefine (v)snprintf when needed.","fromName":"Benoit Sigoure","fromEmail":"tsunanet@gmail.com","sentAt":"2014-01-31T17:36:28Z","receivedAt":"2014-01-31T17:36:28Z","isPatch":true,"sender":{"key":"tsunanet@gmail.com","avatar":"https://avatars.githubusercontent.com/u/128281?v=4"},"body":"When we detect that vsnprintf / snprintf are broken, we #define them to\nan alternative implementation.  On OS X, stdio.h already #define's them,\nwhich causes a warning to be issued at the point we re-define them in\n`git-compat-util.h'.\n\nSigned-off-by: Benoit Sigoure <tsunanet@gmail.com>\n---\n git-compat-util.h | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex cbd86c3..614a5e9 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -480,9 +480,15 @@ extern FILE *git_fopen(const char*, const char*);\n #endif\n \n #ifdef SNPRINTF_RETURNS_BOGUS\n+#ifdef snprintf\n+#undef snprintf\n+#endif\n #define snprintf git_snprintf\n extern int git_snprintf(char *str, size_t maxsize,\n \t\t\tconst char *format, ...);\n+#ifdef vsnprintf\n+#undef vsnprintf\n+#endif\n #define vsnprintf git_vsnprintf\n extern int git_vsnprintf(char *str, size_t maxsize,\n \t\t\t const char *format, va_list ap);\n-- \n1.9.rc1.1.g186f0be.dirty\n"}]}