Skip to content

Commit

Permalink
Fix preprocessor logic that determines the availablity of strchrnul().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Sixt authored and Junio C Hamano committed Nov 13, 2007
1 parent 9e79f00 commit 726c8ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,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)
{
Expand Down

0 comments on commit 726c8ef

Please sign in to comment.