1
Fork 0

bpo-31474: Fix -Wint-in-bool-context warnings (#3581)

Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
Christian Heimes 2017-09-15 20:27:23 +02:00 committed by GitHub
parent c7f165fe65
commit fd39e2a684
2 changed files with 3 additions and 2 deletions

View File

@ -72,9 +72,9 @@ PyAPI_FUNC(void) PyMem_Free(void *);
/* 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) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: malloc((n) ? (n) : 1))
: malloc(((n) != 0) ? (n) : 1))
#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: realloc((p), (n) ? (n) : 1))
: realloc((p), ((n) != 0) ? (n) : 1))
#define PyMem_FREE free
#endif /* PYMALLOC_DEBUG */

View File

@ -0,0 +1 @@
Fix -Wint-in-bool-context warnings in PyMem_MALLOC and PyMem_REALLOC macros