summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMatthias Klose <doko@ubuntu.com>2009-04-04 15:51:23 (GMT)
committerMatthias Klose <doko@ubuntu.com>2009-04-04 15:51:23 (GMT)
commit8212a823712061550c1757ef688cde0f4faec953 (patch)
treee74c725f24f5b8a08ffc3425c5b2b39c59aea5b9 /Include
parentedb5e1e09ecf92a4911c154217c9c979d827caeb (diff)
downloadcpython-8212a823712061550c1757ef688cde0f4faec953.zip
cpython-8212a823712061550c1757ef688cde0f4faec953.tar.gz
cpython-8212a823712061550c1757ef688cde0f4faec953.tar.bz2
- Py_DECREF: Add `do { ... } while (0)' to avoid compiler warnings.
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/Include/object.h b/Include/object.h
index cfca64f..fb5376a 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -749,11 +749,13 @@ PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force);
((PyObject*)(op))->ob_refcnt++)
#define Py_DECREF(op) \
- if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
- --((PyObject*)(op))->ob_refcnt != 0) \
- _Py_CHECK_REFCNT(op) \
- else \
- _Py_Dealloc((PyObject *)(op))
+ do { \
+ if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
+ --((PyObject*)(op))->ob_refcnt != 0) \
+ _Py_CHECK_REFCNT(op) \
+ else \
+ _Py_Dealloc((PyObject *)(op)) \
+ } while (0)
/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear
* and tp_dealloc implementatons.