From 99ef6461328c87ae02ccb28f99e5e69e3b9643f6 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 11 Mar 2011 19:58:48 +0000 Subject: [PATCH] Remove the treacherous NDEBUG markers --- panda/src/linmath/lpoint2_ext_src.I | 2 -- panda/src/linmath/lpoint3_ext_src.I | 4 +--- panda/src/linmath/lpoint4_ext_src.I | 4 +--- panda/src/linmath/lvecBase2_ext_src.I | 10 ++++------ panda/src/linmath/lvecBase3_ext_src.I | 12 +++++------- panda/src/linmath/lvecBase4_ext_src.I | 12 +++++------- panda/src/linmath/lvector2_ext_src.I | 4 +--- panda/src/linmath/lvector3_ext_src.I | 4 +--- panda/src/linmath/lvector4_ext_src.I | 4 +--- 9 files changed, 19 insertions(+), 37 deletions(-) diff --git a/panda/src/linmath/lpoint2_ext_src.I b/panda/src/linmath/lpoint2_ext_src.I index 9a3e306bbe..6594709896 100644 --- a/panda/src/linmath/lpoint2_ext_src.I +++ b/panda/src/linmath/lpoint2_ext_src.I @@ -36,14 +36,12 @@ python_repr, ostream &out, const string &class_name) { //////////////////////////////////////////////////////////////////// INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint2), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it != 'x' && *it != 'y') { return NULL; } } -#endif if (attr_name.size() == 1) { return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']); diff --git a/panda/src/linmath/lpoint3_ext_src.I b/panda/src/linmath/lpoint3_ext_src.I index 1de55c09d5..b19e2776b6 100644 --- a/panda/src/linmath/lpoint3_ext_src.I +++ b/panda/src/linmath/lpoint3_ext_src.I @@ -25,7 +25,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint3); //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint3), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ", " << MAYBE_ZERO(this->_v.v._2) << ")"; @@ -38,14 +38,12 @@ python_repr, ostream &out, const string &class_name) { //////////////////////////////////////////////////////////////////// PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint3), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'x' || *it > 'z') { return NULL; } } -#endif if (attr_name.size() == 1) { return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']); diff --git a/panda/src/linmath/lpoint4_ext_src.I b/panda/src/linmath/lpoint4_ext_src.I index 3354ce2646..75dab146bc 100644 --- a/panda/src/linmath/lpoint4_ext_src.I +++ b/panda/src/linmath/lpoint4_ext_src.I @@ -26,7 +26,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LPoint4); //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint4), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ", " << MAYBE_ZERO(this->_v.v._2) << ", " @@ -40,14 +40,12 @@ python_repr, ostream &out, const string &class_name) { //////////////////////////////////////////////////////////////////// INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LPoint4), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'w' || *it > 'z') { return NULL; } } -#endif if (attr_name.size() == 1) { if (attr_name[0] == 'w') { diff --git a/panda/src/linmath/lvecBase2_ext_src.I b/panda/src/linmath/lvecBase2_ext_src.I index 8407de4fb3..f7a0a33e29 100644 --- a/panda/src/linmath/lvecBase2_ext_src.I +++ b/panda/src/linmath/lvecBase2_ext_src.I @@ -57,7 +57,7 @@ __reduce__, PyObject *self) { return NULL; } - PyObject *result = Py_BuildValue("(O(ff))", this_class, + PyObject *result = Py_BuildValue("(O(ff))", this_class, (*this)[0], (*this)[1]); Py_DECREF(this_class); return result; @@ -70,14 +70,12 @@ __reduce__, PyObject *self) { //////////////////////////////////////////////////////////////////// PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase2), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it != 'x' && *it != 'y') { return NULL; } } -#endif if (attr_name.size() == 1) { return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']); @@ -118,14 +116,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // Whoosh. PyObject* fast = PySequence_Fast(assign, ""); nassertr(fast != NULL, -1); - + // Let's be strict about size mismatches, to prevent user error. if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) { PyErr_SetString(PyExc_ValueError, "length mismatch"); Py_DECREF(fast); return -1; } - + // Get a pointer to the items, iterate over it and // perform our magic assignment. Fast fast. Oh yeah. PyObject** items = PySequence_Fast_ITEMS(fast); @@ -167,7 +165,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // and assign the floating-point value to every one of them. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { this->_v.data[(*it) - 'x'] = value; - } + } } return 0; diff --git a/panda/src/linmath/lvecBase3_ext_src.I b/panda/src/linmath/lvecBase3_ext_src.I index edb28db330..fd0896da66 100644 --- a/panda/src/linmath/lvecBase3_ext_src.I +++ b/panda/src/linmath/lvecBase3_ext_src.I @@ -36,7 +36,7 @@ __setitem__, int i, FLOATTYPE v) { //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase3), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ", " << MAYBE_ZERO(this->_v.v._2) << ")"; @@ -59,7 +59,7 @@ __reduce__, PyObject *self) { return NULL; } - PyObject *result = Py_BuildValue("(O(fff))", this_class, + PyObject *result = Py_BuildValue("(O(fff))", this_class, (*this)[0], (*this)[1], (*this)[2]); Py_DECREF(this_class); return result; @@ -72,14 +72,12 @@ __reduce__, PyObject *self) { //////////////////////////////////////////////////////////////////// PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase3), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'x' || *it > 'z') { return NULL; } } -#endif if (attr_name.size() == 1) { return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']); @@ -123,14 +121,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // Whoosh. PyObject* fast = PySequence_Fast(assign, ""); nassertr(fast != NULL, -1); - + // Let's be strict about size mismatches, to prevent user error. if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) { PyErr_SetString(PyExc_ValueError, "length mismatch"); Py_DECREF(fast); return -1; } - + // Get a pointer to the items, iterate over it and // perform our magic assignment. Fast fast. Oh yeah. PyObject** items = PySequence_Fast_ITEMS(fast); @@ -172,7 +170,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // and assign the floating-point value to every one of them. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { this->_v.data[(*it) - 'x'] = value; - } + } } return 0; diff --git a/panda/src/linmath/lvecBase4_ext_src.I b/panda/src/linmath/lvecBase4_ext_src.I index 15148742ec..d43d1aeff1 100644 --- a/panda/src/linmath/lvecBase4_ext_src.I +++ b/panda/src/linmath/lvecBase4_ext_src.I @@ -37,7 +37,7 @@ __setitem__, int i, FLOATTYPE v) { //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase4), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ", " << MAYBE_ZERO(this->_v.v._2) << ", " @@ -61,7 +61,7 @@ __reduce__, PyObject *self) { return NULL; } - PyObject *result = Py_BuildValue("(O(ffff))", this_class, + PyObject *result = Py_BuildValue("(O(ffff))", this_class, (*this)[0], (*this)[1], (*this)[2], (*this)[3]); Py_DECREF(this_class); return result; @@ -74,14 +74,12 @@ __reduce__, PyObject *self) { //////////////////////////////////////////////////////////////////// PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVecBase4), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'w' || *it > 'z') { return NULL; } } -#endif if (attr_name.size() == 1) { if (attr_name[0] == 'w') { @@ -137,14 +135,14 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // Whoosh. PyObject* fast = PySequence_Fast(assign, ""); nassertr(fast != NULL, -1); - + // Let's be strict about size mismatches, to prevent user error. if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) { PyErr_SetString(PyExc_ValueError, "length mismatch"); Py_DECREF(fast); return -1; } - + // Get a pointer to the items, iterate over it and // perform our magic assignment. Fast fast. Oh yeah. PyObject** items = PySequence_Fast_ITEMS(fast); @@ -186,7 +184,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // and assign the floating-point value to every one of them. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { this->_v.data[((*it) == 'w') ? 3 : (*it) - 'x'] = value; - } + } } return 0; diff --git a/panda/src/linmath/lvector2_ext_src.I b/panda/src/linmath/lvector2_ext_src.I index 86c6a054d0..5307896b67 100644 --- a/panda/src/linmath/lvector2_ext_src.I +++ b/panda/src/linmath/lvector2_ext_src.I @@ -24,7 +24,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector2); //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVector2), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ")"; } @@ -36,14 +36,12 @@ python_repr, ostream &out, const string &class_name) { //////////////////////////////////////////////////////////////////// INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVector2), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it != 'x' && *it != 'y') { return NULL; } } -#endif if (attr_name.size() == 1) { return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']); diff --git a/panda/src/linmath/lvector3_ext_src.I b/panda/src/linmath/lvector3_ext_src.I index 04e8697ceb..523e79cbf4 100644 --- a/panda/src/linmath/lvector3_ext_src.I +++ b/panda/src/linmath/lvector3_ext_src.I @@ -25,7 +25,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector3); //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVector3), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ", " << MAYBE_ZERO(this->_v.v._2) << ")"; @@ -38,14 +38,12 @@ python_repr, ostream &out, const string &class_name) { //////////////////////////////////////////////////////////////////// INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVector3), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'x' || *it > 'z') { return NULL; } } -#endif if (attr_name.size() == 1) { return PyFloat_FromDouble(this->_v.data[attr_name[0] - 'x']); diff --git a/panda/src/linmath/lvector4_ext_src.I b/panda/src/linmath/lvector4_ext_src.I index f28678eb8a..1125379f7a 100644 --- a/panda/src/linmath/lvector4_ext_src.I +++ b/panda/src/linmath/lvector4_ext_src.I @@ -26,7 +26,7 @@ IMPORT_THIS struct Dtool_PyTypedObject FLOATNAME(Dtool_LVector4); //////////////////////////////////////////////////////////////////// INLINE void EXT_CONST_METHOD_ARGS(FLOATNAME(LVector4), python_repr, ostream &out, const string &class_name) { - out << class_name << "(" + out << class_name << "(" << MAYBE_ZERO(this->_v.v._0) << ", " << MAYBE_ZERO(this->_v.v._1) << ", " << MAYBE_ZERO(this->_v.v._2) << ", " @@ -40,14 +40,12 @@ python_repr, ostream &out, const string &class_name) { //////////////////////////////////////////////////////////////////// INLINE PyObject *EXT_CONST_METHOD_ARGS(FLOATNAME(LVector4), __getattr__, const string &attr_name) { -#ifndef NDEBUG // Validate the attribute name. for (string::const_iterator it = attr_name.begin(); it < attr_name.end(); it++) { if (*it < 'w' || *it > 'z') { return NULL; } } -#endif if (attr_name.size() == 1) { if (attr_name[0] == 'w') {