Fix preprocessor logic that determines the availablity of strchrnul().
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Nov 12, 2007 at 11:09 UTC
726c8ef5a5a129d8157d0043f60fe7195d2cdb77
1 file changed
+7
-1
git-compat-util.h
+7
-1
@@ -183,7 +183,13 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
183
const void *needle, size_t needlelen);
184
#endif
185
186
-#if !defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 1)
186
+#ifdef __GLIBC_PREREQ
187
+#if __GLIBC_PREREQ(2, 1)
188
+#define HAVE_STRCHRNUL
189
+#endif
190
+#endif
191
+
192
+#ifndef HAVE_STRCHRNUL
193
#define strchrnul gitstrchrnul
194
static inline char *gitstrchrnul(const char *s, int c)
195
{