diff options
Diffstat (limited to 'python/modules/IcePy/Util.h')
-rw-r--r-- | python/modules/IcePy/Util.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/python/modules/IcePy/Util.h b/python/modules/IcePy/Util.h index 94f8d1b813d..5732a9d10df 100644 --- a/python/modules/IcePy/Util.h +++ b/python/modules/IcePy/Util.h @@ -20,8 +20,8 @@ // instead of the standard ones in order to avoid GCC warnings about // strict aliasing and type punning. // -#define PyRETURN_FALSE return Py_INCREF(getFalse()), getFalse() -#define PyRETURN_TRUE return Py_INCREF(getTrue()), getTrue() +#define PyRETURN_FALSE return incFalse() +#define PyRETURN_TRUE return incTrue() #define PyRETURN_BOOL(b) if(b) PyRETURN_TRUE; else PyRETURN_FALSE @@ -56,6 +56,20 @@ inline PyObject* getTrue() #endif } +inline PyObject* incFalse() +{ + PyObject* f = getFalse(); + Py_INCREF(f); + return f; +} + +inline PyObject* incTrue() +{ + PyObject* t = getTrue(); + Py_INCREF(t); + return t; +} + // // Create a string object. // |