Re: [PATCH] msvc: Directly use MS version (_stricmp) of strcasecmp
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 20, 2018, 01:58 UTC
- Message-ID
- <xmqqefbgcxwl.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <15a7df69-25d8-c168-dd43-a43b7f0d34c1@cs-ware.de>
Sven Strickroth <email@cs-ware.de> writes:
Show 8 quoted lines
> 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@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.
Show 24 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