Cleanly redefine (v)snprintf when needed.
PATCH 1/1 Cleanly redefine (v)snprintf when needed.
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(+)
git-compat-util.h +6 -0
@@ -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_snprintfextern int git_snprintf (char *str,size_t maxsize,const char *format, ...); +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf git_vsnprintfextern int git_vsnprintf (char *str,size_t maxsize,const char *format,va_list ap);
Signature · 1 line
1.9.rc1.1.g186f0be.dirty
Quoted 5 lines · Benoit Sigoure
When we detect that vsnprintf / snprintf are broken, we #define them to an alternative implementation. On OS X,
stdio.halready #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.
Quoted 23 lines
git-compat-util.h | 6 ++++++ 1 file changed, 6 insertions(+)git-compat-util.h +6
-0@@ -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_snprintfextern int git_snprintf (char *str,size_t maxsize,const char *format, ...); +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf git_vsnprintfextern int git_vsnprintf (char *str,size_t maxsize,const char *format,va_list ap);
PATCH 1/1 Cleanly redefine (v)snprintf when needed.
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(+)
git-compat-util.h +6 -0
@@ -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_snprintfextern int git_snprintf (char *str,size_t maxsize,const char *format, ...); +#ifdef vsnprintf +#undef vsnprintf +#endif #define vsnprintf git_vsnprintfextern int git_vsnprintf (char *str,size_t maxsize,const char *format,va_list ap);
Signature · 1 line
1.9.rc1.1.g186f0be.dirty