diff options
author | Bastien Montagne <bastien@blender.org> | 2020-11-02 19:07:39 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-11-02 19:08:10 +0300 |
commit | 20c4aa13de7ba403e113df8ec69c632b6815eac8 (patch) | |
tree | 2a55c88fc53e1417b8d3cf299db0c13edf631673 | |
parent | db18ba07b502fd64955626241a6a40333cdc63bd (diff) |
Cleanup: store results of function calls in const values.
-rw-r--r-- | source/blender/python/intern/bpy_props.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index d45c8e8b131..a2552ab25b9 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -3388,7 +3388,10 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) if (!ptype) { return NULL; } - if (!RNA_struct_is_a(ptype, &RNA_PropertyGroup) && !RNA_struct_is_ID(ptype)) { + const bool is_property_group = RNA_struct_is_a(ptype, &RNA_PropertyGroup); + const bool is_id = RNA_struct_is_ID(ptype); + + if (!is_property_group && !is_id) { PyErr_Format(PyExc_TypeError, "PointerProperty(...) expected an RNA type derived from %.200s or %.200s", RNA_struct_ui_name(&RNA_ID), @@ -3413,7 +3416,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) } if (RNA_struct_idprops_contains_datablock(ptype)) { - if (RNA_struct_is_a(srna, &RNA_PropertyGroup)) { + if (is_property_group) { RNA_def_struct_flag(srna, STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES); } } |