From: Junio C Hamano Date: Sun, 11 Nov 2007 10:44:06 GMT Subject: Re: [PATCH] Simplify strchrnul() compat code Message-ID: <7v6409f4eh.fsf@gitster.siamese.dyndns.org> In-Reply-To: <4735BA79.5020102@op5.se> Andreas Ericsson writes: > René Scharfe wrote: >> -#ifdef NO_STRCHRNUL >> +#if !defined(__GLIBC__) && !__GLIBC_PREREQ(2, 1) > > This will break things for users of glibc-2.1.1 (the first release still > available from ftp://sources.redhat.com/pub/glibc/old-releases that > includes the strchrnul() function), since __GLIBC_PREREQ() was invented > after strchrnul() was introduced. > > Replacing __GLIBC__ with __GLIBC_PREREQ (as in the original patch) will > solve it nicely. Users of glibc-2.1.1 will be the odd minority where > strchrnul() is available in their libc but not used. Do you mean this on top of René's patch? Although I do not think I saw "the original patch" that did it this way, I think it makes sense. diff --git a/git-compat-util.h b/git-compat-util.h index 11e6df6..dd96f7a 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -183,7 +183,7 @@ void *gitmemmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen); #endif -#if !defined(__GLIBC__) && !__GLIBC_PREREQ(2, 1) +#if !defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 1) #define strchrnul gitstrchrnul static inline char *gitstrchrnul(const char *s, int c) {