From a02cf90144293f4d7885be7f1d10240576aa161b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 26 May 2011 09:25:47 -0700 Subject: [PATCH] compat/fnmatch/fnmatch.c: give a fall-back definition for NULL Somebody tried to compile fnmatch.c compatibility file on Interix and got an error because no header included in the file on that platform defined NULL. It usually comes from stddef.h and indirectly from other headers like string.h, unistd.h, stdio.h, stdlib.h, etc., but with the way we compile this file from our Makefile, inclusion of the header files that are expected to define NULL in fnmatch.c do not happen because they are protected with "#ifdef STDC_HEADERS", etc. which we do not pass. As the least-impact workaround, give a fall-back definition when none of the headers define NULL. Noticed-by: Markus Duft Signed-off-by: Junio C Hamano --- compat/fnmatch/fnmatch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c index 14feac7fe1..9473aed2bb 100644 --- a/compat/fnmatch/fnmatch.c +++ b/compat/fnmatch/fnmatch.c @@ -127,6 +127,10 @@ extern char *getenv (); extern int errno; # endif +# ifndef NULL +# define NULL 0 +# endif + /* This function doesn't exist on most systems. */ # if !defined HAVE___STRCHRNUL && !defined _LIBC -- 2.47.1