Cleanup: use const variables where possible in the Python API

This commit is contained in:
2020-08-20 16:10:13 +10:00
parent 8877e3aa62
commit efa7aaa97f
35 changed files with 134 additions and 132 deletions

View File

@@ -351,7 +351,7 @@ static bool bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *
value = false;
}
else {
int value_i = PyC_Long_AsBool(ret);
const int value_i = PyC_Long_AsBool(ret);
if (value_i == -1 && PyErr_Occurred()) {
PyC_Err_PrintWithFunc(py_func);
@@ -443,7 +443,7 @@ static bool bpy_prop_poll_cb(struct PointerRNA *self,
PyObject *ret;
bool result;
const int is_write_ok = pyrna_write_check();
PyGILState_STATE gilstate = PyGILState_Ensure();
const PyGILState_STATE gilstate = PyGILState_Ensure();
BLI_assert(self != NULL);
@@ -560,7 +560,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr,
PyGILState_STATE gilstate;
bool use_gil;
const bool is_write_ok = pyrna_write_check();
int len = RNA_property_array_length(ptr, prop);
const int len = RNA_property_array_length(ptr, prop);
BLI_assert(py_data != NULL);
@@ -804,7 +804,7 @@ static void bpy_prop_int_array_set_cb(struct PointerRNA *ptr,
PyGILState_STATE gilstate;
bool use_gil;
const bool is_write_ok = pyrna_write_check();
int len = RNA_property_array_length(ptr, prop);
const int len = RNA_property_array_length(ptr, prop);
BLI_assert(py_data != NULL);
@@ -1048,7 +1048,7 @@ static void bpy_prop_float_array_set_cb(struct PointerRNA *ptr,
PyGILState_STATE gilstate;
bool use_gil;
const bool is_write_ok = pyrna_write_check();
int len = RNA_property_array_length(ptr, prop);
const int len = RNA_property_array_length(ptr, prop);
BLI_assert(py_data != NULL);