# [PATCH] Fix a strchrnul() related build error

3 messages from 2007-11-12 to 2007-11-12. Participants: Emil Medve, Johannes Schindelin, Medve Emilian.
Thread: https://gitlist.dev/t/10838

## Emil Medve, 2007-11-12 21:01

Subject: [PATCH] Fix a strchrnul() related build error
Message-ID: <1194901282-2468-1-git-send-email-Emilian.Medve@Freescale.com>
URL: https://gitlist.dev/e/1194901282-2468-1-git-send-email-Emilian.Medve%40Freescale.com

```
Systems/environments without glibc (such as CygWin), and as a consequence whithout the
__GLIBC_PREREQ() macro, fail to build with the following error message:

    CC git.o
In file included from builtin.h:4,
                 from git.c:1:
git-compat-util.h:187:48: missing binary operator before token "("

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---

Here is a relevant comment from my Linux box features.h:

/* Convenience macros to test the versions of glibc and gcc.
   Use them like this:
   #if __GNUC_PREREQ (2,8)
   ... code requiring gcc 2.8 or later ...
   #endif
   Note - they won't work for gcc1 or glibc1, since the _MINOR macros
   were not defined then.  */

My CygWin gcc version is:

$ gcc -dumpversion
3.4.4

This applies to next

 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..c4ed308 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)
+#ifndef __GLIBC_PREREQ
+#define NO_STRCHRNUL
+#elif !__GLIBC_PREREQ(2, 1)
+#define NO_STRCHRNUL
+#endif
+
+#ifdef NO_STRCHRNUL
 #define strchrnul gitstrchrnul
 static inline char *gitstrchrnul(const char *s, int c)
 {
-- 
1.5.3.5.1466.gfa36

```

## Johannes Schindelin, 2007-11-12 21:27

Subject: Re: [PATCH] Fix a strchrnul() related build error
Message-ID: <Pine.LNX.4.64.0711122126370.4362@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0711122126370.4362%40racer.site
In-Reply-To: <1194901282-2468-1-git-send-email-Emilian.Medve@Freescale.com>

```
Hi,

didn't Johannes Sixt provide a (slightly nicer) patch earlier today?

Ciao,
Dscho

```

## Medve Emilian, 2007-11-12 22:12

Subject: RE: [PATCH] Fix a strchrnul() related build error
Message-ID: <598D5675D34BE349929AF5EDE9B03E27017BC128@az33exm24.fsl.freescale.net>
URL: https://gitlist.dev/e/598D5675D34BE349929AF5EDE9B03E27017BC128%40az33exm24.fsl.freescale.net
In-Reply-To: <Pine.LNX.4.64.0711122126370.4362@racer.site>

```
Hi Dscho,

> didn't Johannes Sixt provide a (slightly nicer) patch earlier today?

That is nicer and should go into the tree.


Cheers,
Emil.

```
