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

[PATCH] compat/fnmatch: Rename wchar functions to standard API

From
Vincent van Ravesteijn <vfr@lyx.org>
Date
Jun 6, 2012, 13:08 UTC
Message-ID
<1338988096-2136-1-git-send-email-vfr@lyx.org>

On a platform that does not have glibc but does have 'wchar.h' or 'wctype.h', the functions '__iswctype' and '__btowc' must be renamed to standard API. If not, git cannot be compiled on the platform.

This code is taken from compat/regex/regex_internal.h.
Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
 compat/fnmatch/fnmatch.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/compat/fnmatch/fnmatch.c b/compat/fnmatch/fnmatch.c
index 9473aed..3f9e3d6 100644
--- a/compat/fnmatch/fnmatch.c
+++ b/compat/fnmatch/fnmatch.c
@@ -99,11 +99,19 @@
 #   define CHAR_CLASS_MAX_LENGTH 256
 #  endif
 
-#  ifdef _LIBC
-#   define IS_CHAR_CLASS(string) __wctype (string)
-#  else
-#   define IS_CHAR_CLASS(string) wctype (string)
+/* Rename to standard API for using out of glibc.  */
+#  ifndef _LIBC
+#   ifdef __wctype
+#    undef __wctype
+#   endif
+#   define __wctype wctype
+#   ifdef __iswctype
+#    undef __iswctype
+#   endif
+#   define __iswctype iswctype
+#   define __btowc btowc
 #  endif
+#  define IS_CHAR_CLASS(string) __wctype (string)
 # else
 #  define CHAR_CLASS_MAX_LENGTH  6 /* Namely, `xdigit'.  */
 
-- 
1.7.9.msysgit.0
Message 1 of 1 in “compat/fnmatch: Rename wchar functions to standard API”
  1. compat/fnmatch: Rename wchar functions to standard APIVincent van Ravesteijn, Jun 6, 2012

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.