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

[PATCH] Fix preprocessor logic that determines the availablity of strchrnul().

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Nov 12, 2007, 10:09 UTC
Message-ID
<47382641.3080109@viscovery.net>
In-Reply-To
<ee77f5c20711120152i4955ed3bh484c9ac76a7f1f5c@mail.gmail.com>

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>
---
  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..276a437 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)
+#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)
  {
-- 
1.5.3.5.578.g1f8ec
Previous: Jakub Narebski
Message 18 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.