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

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 20, 2018, 20:52 UTC
Message-ID
<nycvar.QRO.7.76.6.1811202144390.41@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqefbgcxwl.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Tue, 20 Nov 2018, Junio C Hamano wrote:
Show 5 quoted lines
> Sven Strickroth <email@cs-ware.de> writes:
> 
> > This also removes an implicit conversion from size_t (unsigned) to int (signed).
> >
> > _stricmp as well as _strnicmp are both available since VS2012.
Looks good to me.
Show 10 quoted lines
> > Signed-off-by: Sven Strickroth <email@cs-ware.de>
> > ---
> >  compat/msvc.h | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> Will apply, thanks.
> 
> The substition from ftello with _ftelli64 does not appear in our
> codebase yet, but it was easy enough to adjust the patch myself, so
> no need to resend this patch.
Indeed, that is only in Git for Windows' code base yet, AFAICT.

For the record: I am currently holding off from contributing those patches (I am talking about the patch series to make Git compile with MS Visual C++ on the command line, followed by the patch series to generate project definitions ready for use with MS Visual Studio) because of the feature freeze. I had hoped to be able to contribute them sooner, but it took Jeff Hostetler and myself a combined gargantuan effort to reorder and disentangle Git for Windows' branch thicket so that those patches apply cleanly on top of git.git's `master`.

Happily, almost all of the prerequisites made it upstream (e.g. the nanosecond support for Windows, the patches to require Windows Vista or later, the patch to use CreateHardLink() directly, etc). By my counting, only two, relatively small patch series are left, and both are already under discussion (but on hold, due to the code freeze).

For interested parties: the current shape of the `visual-studio` patch series can be seen here: https://github.com/git-for-windows/git/compare/581eb5441089%5E...581eb5441089%5E2 and the current shape of the `msvc` patch series can be seen here: https://github.com/git-for-windows/git/compare/e9e7bd2a2485%5E...e9e7bd2a2485%5E2

Ciao, Dscho

Show 26 quoted lines
> 
> > diff --git a/compat/msvc.h b/compat/msvc.h
> > index e6e1a6bbf7..2d558bae14 100644
> > --- a/compat/msvc.h
> > +++ b/compat/msvc.h
> > @@ -14,18 +14,12 @@
> >  #define inline __inline
> >  #define __inline__ __inline
> >  #define __attribute__(x)
> > +#define strcasecmp   _stricmp
> >  #define strncasecmp  _strnicmp
> >  #define ftruncate    _chsize
> >  #define strtoull     _strtoui64
> >  #define strtoll      _strtoi64
> >  
> > -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);
> > -}
> > -
> >  #undef ERROR
> >  
> >  #define ftello _ftelli64
> 
Previous: Junio C Hamano
Message 6 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.