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

Re: [PATCH] msvc: Directly use MS version (_stricmp) of strcasecmp

From
Jeff King <peff@peff.net>
Date
Nov 18, 2018, 21:58 UTC
Message-ID
<20181118215820.GA14514@sigill.intra.peff.net>
In-Reply-To
<ad85731f-2c47-f455-c9d3-d47a5fj1e29@cs-ware.de>
On Sun, Nov 18, 2018 at 10:02:02PM +0100, Sven Strickroth wrote:
> This also removes an implicit conversion from size_t (unsigned) to int (signed).
> 
> _stricmp as well as _strnicmp are both available since VS2012.

Once upon a time we had problems with taking a function pointer of strcasecmp (to use as a comparator with string_list), so I wondered if that might be part of why it's defined the way it is.

But the current definition is already inline:
Show 8 quoted lines
> -
> -static __inline int strcasecmp (const char *s1, const char *s2)
> -{
> -       int size1 = strlen(s1);
> -       int sisz2 = strlen(s2);
> -       return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
> -}
> +#define strcasecmp   _stricmp

And it seems we worked around this in de2f95ebed (mailmap: work around implementations with pure inline strcasecmp, 2013-09-12). So I don't think there is any blocker there.

(Though of course I have no idea on other portability questions around _stricmp(); I'll leave that for Windows folks).

-Peff
Previous: Sven StrickrothNext: Junio C Hamano
Message 2 of 6 in “msvc: Directly use MS version (_stricmp) of strcasecmp”
  1. msvc: Directly use MS version (_stricmp) of strcasecmpSven Strickroth, Nov 18, 2018
  2. Jeff KingNov 18, 2018
  3. Junio C HamanoNov 19, 2018
  4. msvc: Directly use MS version (_stricmp) of strcasecmpSven Strickroth, Nov 19, 2018
  5. Junio C HamanoNov 20, 2018
  6. Johannes SchindelinNov 20, 2018

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.