[PATCH] Fix preprocessor logic that determines the availablity of strchrnul().
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Nov 12, 2007, 10:09 UTC
- Message-ID
- <47382641.3080109@viscovery.net>
- In-Reply-To
- <ee77f5c20711120152i4955ed3bh484c9ac76a7f1f5c@mail.gmail.com>
Apart from the error in the condition (&& should actually be ||), the construct
#if !defined(A) || !A
leads to a syntax error in the C preprocessor if A is indeed not defined.
Tested-by: David Symonds <dsymonds@gmail.com> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> --- git-compat-util.h | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h index 3d147b6..276a437 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -184,7 +184,13 @@ void *gitmemmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); #endif -#if !defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 1) +#ifdef __GLIBC_PREREQ +#if __GLIBC_PREREQ(2, 1) +#define HAVE_STRCHRNUL +#endif +#endif + +#ifndef HAVE_STRCHRNUL #define strchrnul gitstrchrnul static inline char *gitstrchrnul(const char *s, int c) {
-- 1.5.3.5.578.g1f8ec