git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Cleanly redefine (v)snprintf when needed.

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 31, 2014, 17:28 UTC
Message-ID
<xmqqy51wgiwd.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1391149512-8705-1-git-send-email-tsunanet@gmail.com>
Benoit Sigoure <tsunanet@gmail.com> writes:
Show 5 quoted lines
> 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.
Show 23 quoted lines
>  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);
Previous: Benoit SigoureNext: Benoit Sigoure
Message 2 of 3 in “Cleanly redefine (v)snprintf when needed.”
  1. Cleanly redefine (v)snprintf when needed.Benoit Sigoure, Jan 31, 2014
  2. Junio C HamanoJan 31, 2014
  3. Cleanly redefine (v)snprintf when needed.Benoit Sigoure, Jan 31, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.