[unladen-swallow] r942 committed - Don't redefine ctype macros if they aren't already defined...

1 view
Skip to first unread message

unladen...@googlecode.com

unread,
Dec 17, 2009, 8:48:18 PM12/17/09
to unladen...@googlegroups.com
Revision: 942
Author: abbeyj
Date: Thu Dec 17 17:48:01 2009
Log: Don't redefine ctype macros if they aren't already defined
See Issue 87
http://code.google.com/p/unladen-swallow/source/detail?r=942

Modified:
/trunk/Include/pyport.h

=======================================
--- /trunk/Include/pyport.h Fri Jan 16 10:46:16 2009
+++ /trunk/Include/pyport.h Thu Dec 17 17:48:01 2009
@@ -514,22 +514,40 @@
#if __FreeBSD_version > 500039
#include <ctype.h>
#include <wctype.h>
+/* If the source file #includes <cctype> before "Python.h" then
+ * these macros will not be defined at this point and we
+ * should not define them either.
+ */
+#ifdef isalnum
#undef isalnum
#define isalnum(c) iswalnum(btowc(c))
+#endif
+#ifdef isalpha
#undef isalpha
#define isalpha(c) iswalpha(btowc(c))
+#endif
+#ifdef islower
#undef islower
#define islower(c) iswlower(btowc(c))
+#endif
+#ifdef isspace
#undef isspace
#define isspace(c) iswspace(btowc(c))
+#endif
+#ifdef isupper
#undef isupper
#define isupper(c) iswupper(btowc(c))
+#endif
+#ifdef tolower
#undef tolower
#define tolower(c) towlower(btowc(c))
+#endif
+#ifdef toupper
#undef toupper
#define toupper(c) towupper(btowc(c))
#endif
#endif
+#endif


/* Declarations for symbol visibility.

Reply all
Reply to author
Forward
0 new messages