Cleanup: Use std::string for WM API function return values
This commit is contained in:
@@ -313,7 +313,6 @@ static PyObject *pyop_as_string(PyObject * /*self*/, PyObject *args)
|
||||
bool macro_args = true;
|
||||
int error_val = 0;
|
||||
|
||||
char *buf = nullptr;
|
||||
PyObject *pybuf;
|
||||
|
||||
bContext *C = BPY_context_get();
|
||||
@@ -370,8 +369,9 @@ static PyObject *pyop_as_string(PyObject * /*self*/, PyObject *args)
|
||||
&ptr, kw, false, "Converting py args to operator properties: ");
|
||||
}
|
||||
|
||||
std::string op_string;
|
||||
if (error_val == 0) {
|
||||
buf = WM_operator_pystring_ex(C, nullptr, all_args, macro_args, ot, &ptr);
|
||||
op_string = WM_operator_pystring_ex(C, nullptr, all_args, macro_args, ot, &ptr);
|
||||
}
|
||||
|
||||
WM_operator_properties_free(&ptr);
|
||||
@@ -380,9 +380,8 @@ static PyObject *pyop_as_string(PyObject * /*self*/, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (buf) {
|
||||
pybuf = PyUnicode_FromString(buf);
|
||||
MEM_freeN(buf);
|
||||
if (!op_string.empty()) {
|
||||
pybuf = PyUnicode_FromString(op_string.c_str());
|
||||
}
|
||||
else {
|
||||
pybuf = PyUnicode_FromString("");
|
||||
|
||||
Reference in New Issue
Block a user