diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-06 05:39:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-06 05:39:36 +0400 |
commit | 4c17f8e5de94f3abc65995e7a2964bb9e6ea7642 (patch) | |
tree | 001add4dd98c14818079e5f591d584c5ece7ac6a /source/gameengine/Expressions/PyObjectPlus.cpp | |
parent | 2a7ade9de24860bbd13e4be8480e9285d1f3fe4c (diff) |
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.
Diffstat (limited to 'source/gameengine/Expressions/PyObjectPlus.cpp')
-rw-r--r-- | source/gameengine/Expressions/PyObjectPlus.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp index 87f776a726e..f263bf15f02 100644 --- a/source/gameengine/Expressions/PyObjectPlus.cpp +++ b/source/gameengine/Expressions/PyObjectPlus.cpp @@ -470,7 +470,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef * case KX_PYATTRIBUTE_TYPE_STRING: { STR_String *val = reinterpret_cast<STR_String*>(ptr); - return PyUnicode_FromString(*val); + return PyUnicode_From_STR_String(*val); } case KX_PYATTRIBUTE_TYPE_CHAR: { @@ -1171,6 +1171,11 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v return self->m_proxy; } +PyObject *PyUnicode_From_STR_String(const STR_String& str) +{ + return PyUnicode_FromStringAndSize(str.ReadPtr(), str.Length()); +} + /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// /* deprecation warning management */ |