diff options
author | Johannes Sixt <j.sixt@viscovery.net> | 2007-11-12 11:09:05 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-12 18:16:34 -0800 |
commit | 726c8ef5a5a129d8157d0043f60fe7195d2cdb77 (patch) | |
tree | c3873ba6e35fff1288596f070ef62c0b7380f8bd | |
parent | Simplify strchrnul() compat code (diff) | |
download | tgif-726c8ef5a5a129d8157d0043f60fe7195d2cdb77.tar.xz |
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>
-rw-r--r-- | 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 92d79673f8..ede9408bbd 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -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) { |