Skip to content

Commit

Permalink
msvc: directly use MS version (_stricmp) of strcasecmp
Browse files Browse the repository at this point in the history
This also removes an implicit conversion from size_t (unsigned) to int (signed).

_stricmp as well as _strnicmp are both available since VS2012.

Signed-off-by: Sven Strickroth <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
csware authored and gitster committed Nov 20, 2018
1 parent cae598d commit d27525e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions compat/msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,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

#include "compat/mingw.h"
Expand Down

0 comments on commit d27525e

Please sign in to comment.