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

Re: [PATCH na/strtoimax] Compatibility: declare strtoimax() under NO_STRTOUMAX

From
Johannes Sixt <j6t@kdbg.org>
Date
Nov 5, 2011, 16:34 UTC
Message-ID
<4EB56593.6090402@kdbg.org>
In-Reply-To
<4EB5583E.2030306@kdbg.org>
Am 05.11.2011 16:37, schrieb Johannes Sixt:
> Commit f696543d (Add strtoimax() compatibility function) introduced an
> implementation of the function, but forgot to add a declaration.

On second thought, I'm puzzled: Without this patch and without noticing the warning that strtoimax() was not declared, I had built with NO_STRTOUMAX on MinGW before, and the build succeeded. This means that even though MinGW's headers are not C99, we must have pulled in function strtoimax() from somewhere. I'll investigate later this weekend.

Anyway, this patch does not just add a declaration for the function, but also redirects strtoimax to gitstrtoimax, which is a bit more than the commit message claims. Without this patch, topic na/strtoimax should not build on a non-C99 environment. Can you verify this claim?

-- Hannes
Show 19 quoted lines
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>  git-compat-util.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/git-compat-util.h b/git-compat-util.h
> index feb6f8e..4efef46 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -354,6 +354,8 @@ extern size_t gitstrlcpy(char *, const char *, size_t);
>  #ifdef NO_STRTOUMAX
>  #define strtoumax gitstrtoumax
>  extern uintmax_t gitstrtoumax(const char *, char **, int);
> +#define strtoimax gitstrtoimax
> +extern intmax_t gitstrtoimax(const char *, char **, int);
>  #endif
>  
>  #ifdef NO_STRTOK_R
Previous: NixNext: Ramsay Jones
Message 3 of 6 in “Compatibility: declare strtoimax() under NO_STRTOUMAX”
  1. Compatibility: declare strtoimax() under NO_STRTOUMAXJohannes Sixt, Nov 5, 2011
  2. NixNov 5, 2011
  3. Johannes SixtNov 5, 2011
  4. Ramsay JonesNov 6, 2011
  5. Junio C HamanoNov 6, 2011
  6. Johannes SixtNov 6, 2011

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.