Re: [PATCH 2/2] Include unistd.h.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 26, 2011, 15:48 UTC
- Message-ID
- <7vhb8hzcm8.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20110526022045.GA8172@elie>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Given that we are touching this file anyway, how about relying on > git-compat-util for this?
Many files in compat/ implementation already includes this header, so it logically feels like a sane thing to do. I vaguely recall there was one corner case where we didn't want to do this, but I do not remember the details.
But I am tempted to do the following, as Tor Arntsen suggested, which I think is the least risky solution. I deliberately spelled "0" without the (void *) pointer cast, as this code borrowed from upstream is in old K&R style and nobody talks about "void" elsewhere in the code.
compat/fnmatch/fnmatch.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c index 14feac7..9473aed 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