Subject: Re: [PATCH] git-compat-util: Avoid strcasecmp() being inlined

From: Junio C Hamano <[email-masked]>
Date: Wed, 11 Sep 2013 11:39:39 -0700

Sebastian Schuberth <[email-masked]> writes:

> This is necessary so that read_mailmap() can obtain a pointer to the
> function.

Whoa, I didn't think it is even legal for a C library to supply
strcmp() or strcasecmp() that are purely inline you cannot take the
address of.  The "solution" looks a bit too large a hammer that
affects everybody, not just those who have such a set of header
files.

>  
> +#define __NO_INLINE__ /* do not inline strcasecmp() */
> +#include <string.h>
> +#ifdef HAVE_STRINGS_H
> +#include <strings.h> /* for strcasecmp() */
> +#endif
> +#undef __NO_INLINE__
> +
>  #ifdef WIN32 /* Both MinGW and MSVC */
>  #define _WIN32_WINNT 0x0502
>  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
> @@ -99,10 +106,6 @@
>  #include <stddef.h>
>  #include <stdlib.h>
>  #include <stdarg.h>
> -#include <string.h>
> -#ifdef HAVE_STRINGS_H
> -#include <strings.h> /* for strcasecmp() */
> -#endif
>  #include <errno.h>
>  #include <limits.h>
>  #ifdef NEEDS_SYS_PARAM_H