PyUnicode_From_STR_String utility function which passes STR_String to PyUnicode_FromStringAndSize (saves a call to strlen).

Also made CValue::ConvertKeysToPython use faster list creation and improved some of the macro formatting.
This commit is contained in:
Campbell Barton
2011-11-06 01:39:36 +00:00
parent 2a7ade9de2
commit 4c17f8e5de
81 changed files with 311 additions and 226 deletions

View File

@@ -164,7 +164,7 @@ void SCA_PythonController::SetNamespace(PyObject* pythondictionary)
/* Without __file__ set the sys.argv[0] is used for the filename
* which ends up with lines from the blender binary being printed in the console */
PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr()));
PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_From_STR_String(m_scriptName));
}
#endif
@@ -490,7 +490,7 @@ PyObject* SCA_PythonController::pyattr_get_script(void *self_v, const KX_PYATTRI
// static_cast<void *>(dynamic_cast<Derived *>(obj)) - static_cast<void *>(obj)
SCA_PythonController* self= static_cast<SCA_PythonController*>(self_v);
return PyUnicode_FromString(self->m_scriptText);
return PyUnicode_From_STR_String(self->m_scriptText);
}