git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Simplify strchrnul() compat code

From
David Symonds <dsymonds@gmail.com>
Date
Nov 12, 2007, 09:03 UTC
Message-ID
<ee77f5c20711120103s478e26cdib85f38293423d90c@mail.gmail.com>
In-Reply-To
<7v6409f4eh.fsf@gitster.siamese.dyndns.org>
On Nov 11, 2007 9:44 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 32 quoted lines
> Andreas Ericsson <ae@op5.se> 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)
>  {

I just tested it on my machine (OS X Tiger) now that it's in 'next', and this breaks the build:

    CC git.o
In file included from builtin.h:4,
                 from git.c:1:
git-compat-util.h:187:48: error: missing binary operator before token "("
make: *** [git.o] Error 1
I don't think I have __GLIBC_PREREQ defined anywhere I can find.
Dave.
Previous: Andreas EricssonNext: Johannes Sixt
Message 12 of 18 in “Add strchrnul()”
  1. 1/2 Add strchrnul()René Scharfe, Nov 9, 2007
  2. Johannes SchindelinNov 9, 2007
  3. Jeff KingNov 9, 2007
  4. Andreas EricssonNov 9, 2007
  5. Jakub NarebskiNov 9, 2007
  6. Andreas EricssonNov 9, 2007
  7. Jakub NarebskiNov 9, 2007
  8. Simplify strchrnul() compat codeRené Scharfe, Nov 10, 2007
  9. Andreas EricssonNov 10, 2007
  10. Junio C HamanoNov 11, 2007
  11. Andreas EricssonNov 11, 2007
  12. David SymondsNov 12, 2007
  13. Johannes SixtNov 12, 2007
  14. David SymondsNov 12, 2007
  15. Johannes SixtNov 12, 2007
  16. David SymondsNov 12, 2007
  17. Jakub NarebskiNov 12, 2007
  18. Fix preprocessor logic that determines the availablity of strchrnul().Johannes Sixt, Nov 12, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.