summaryrefslogtreecommitdiff
path: root/Include/pymem.h
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2011-03-16 09:43:06 -0400
committerRonald Oussoren <ronaldoussoren@mac.com>2011-03-16 09:43:06 -0400
commit9d594ca842ed3426393a24236e8452fc0532f527 (patch)
treebe6b249858fb277f0cc512d49b7f54ee439a3dae /Include/pymem.h
parentc04ce0236c49d9f712ab8e4f11758d0b7d35154d (diff)
parent5c23d8fb736f0c55edec98df2030117bea152326 (diff)
downloadcpython-9d594ca842ed3426393a24236e8452fc0532f527.tar.gz
Merge with 3.1
Diffstat (limited to 'Include/pymem.h')
-rw-r--r--Include/pymem.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/Include/pymem.h b/Include/pymem.h
index c8801bbf05..10b5bea5eb 100644
--- a/Include/pymem.h
+++ b/Include/pymem.h
@@ -59,9 +59,9 @@ PyAPI_FUNC(void) PyMem_Free(void *);
/* Macros. */
#ifdef PYMALLOC_DEBUG
/* Redirect all memory operations to Python's debugging allocator. */
-#define PyMem_MALLOC PyObject_MALLOC
-#define PyMem_REALLOC PyObject_REALLOC
-#define PyMem_FREE PyObject_FREE
+#define PyMem_MALLOC _PyMem_DebugMalloc
+#define PyMem_REALLOC _PyMem_DebugRealloc
+#define PyMem_FREE _PyMem_DebugFree
#else /* ! PYMALLOC_DEBUG */
@@ -71,9 +71,9 @@ PyAPI_FUNC(void) PyMem_Free(void *);
pymalloc. To solve these problems, allocate an extra byte. */
/* Returns NULL to indicate error if a negative size or size larger than
Py_ssize_t can represent is supplied. Helps prevents security holes. */
-#define PyMem_MALLOC(n) (((n) < 0 || (n) > PY_SSIZE_T_MAX) ? NULL \
+#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: malloc((n) ? (n) : 1))
-#define PyMem_REALLOC(p, n) (((n) < 0 || (n) > PY_SSIZE_T_MAX) ? NULL \
+#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: realloc((p), (n) ? (n) : 1))
#define PyMem_FREE free