[pypy-svn] r74766 - pypy/trunk/pypy/module/cpyext/include

afa at codespeak.net afa at codespeak.net
Wed May 26 11:46:39 CEST 2010


Author: afa
Date: Wed May 26 11:46:38 2010
New Revision: 74766

Modified:
   pypy/trunk/pypy/module/cpyext/include/Python.h
   pypy/trunk/pypy/module/cpyext/include/pyport.h
Log:
Move code from Python.h to pyport.h, avoids duplicate definitions


Modified: pypy/trunk/pypy/module/cpyext/include/Python.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/Python.h	(original)
+++ pypy/trunk/pypy/module/cpyext/include/Python.h	Wed May 26 11:46:38 2010
@@ -35,37 +35,6 @@
 
 #define Py_USING_UNICODE
 
-// from pyport.h
-#ifdef SIZE_MAX
-#define PY_SIZE_MAX SIZE_MAX
-#else
-#define PY_SIZE_MAX ((size_t)-1)
-#endif
-/* uintptr_t is the C9X name for an unsigned integral type such that a
- * legitimate void* can be cast to uintptr_t and then back to void* again
- * without loss of information.  Similarly for intptr_t, wrt a signed
- * integral type.
- */
-#ifdef HAVE_UINTPTR_T
-typedef uintptr_t   Py_uintptr_t;
-typedef intptr_t    Py_intptr_t;
-
-#elif SIZEOF_VOID_P <= SIZEOF_INT
-typedef unsigned int    Py_uintptr_t;
-typedef int     Py_intptr_t;
-
-#elif SIZEOF_VOID_P <= SIZEOF_LONG
-typedef unsigned long   Py_uintptr_t;
-typedef long        Py_intptr_t;
-
-#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
-typedef unsigned PY_LONG_LONG   Py_uintptr_t;
-typedef PY_LONG_LONG        Py_intptr_t;
-
-#else
-#   error "Python needs a typedef for Py_uintptr_t in pyport.h."
-#endif /* HAVE_UINTPTR_T */
-
 #include <stdlib.h>
 
 /* Convert a possibly signed character to a nonnegative int */

Modified: pypy/trunk/pypy/module/cpyext/include/pyport.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/pyport.h	(original)
+++ pypy/trunk/pypy/module/cpyext/include/pyport.h	Wed May 26 11:46:38 2010
@@ -16,4 +16,29 @@
 #define PY_SIZE_MAX ((size_t)-1)
 #endif
 
+/* uintptr_t is the C9X name for an unsigned integral type such that a
+ * legitimate void* can be cast to uintptr_t and then back to void* again
+ * without loss of information.  Similarly for intptr_t, wrt a signed
+ * integral type.
+ */
+#ifdef HAVE_UINTPTR_T
+typedef uintptr_t   Py_uintptr_t;
+typedef intptr_t    Py_intptr_t;
+
+#elif SIZEOF_VOID_P <= SIZEOF_INT
+typedef unsigned int    Py_uintptr_t;
+typedef int     Py_intptr_t;
+
+#elif SIZEOF_VOID_P <= SIZEOF_LONG
+typedef unsigned long   Py_uintptr_t;
+typedef long        Py_intptr_t;
+
+#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)
+typedef unsigned PY_LONG_LONG   Py_uintptr_t;
+typedef PY_LONG_LONG        Py_intptr_t;
+
+#else
+#   error "Python needs a typedef for Py_uintptr_t in pyport.h."
+#endif /* HAVE_UINTPTR_T */
+
 #endif /* Py_PYPORT_H */



More information about the Pypy-commit mailing list