diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-15 13:48:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-15 13:48:35 +0300 |
commit | 4be4c06671551da62edf197df6e7ad8c89dc2fe0 (patch) | |
tree | 17592201ff98be5c4d6fbd69b9f8c102a168365e /source/blender/editors | |
parent | 80edc0e972a2dde85509968832ce21f46d86ce58 (diff) |
Cleanup: redundant checks
In some cases moved the checks into asserts,
to ensure changes in the future don't cause
the checks to become necessary again.
Diffstat (limited to 'source/blender/editors')
4 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index ae50090d791..f11e3a1f5f0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -591,11 +591,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) DEG_relations_tag_update(bmain); } else { - if (id) { - Main *bmain = CTX_data_main(C); - id_single_user(C, id, &template_ui->ptr, template_ui->prop); - DEG_relations_tag_update(bmain); - } + Main *bmain = CTX_data_main(C); + id_single_user(C, id, &template_ui->ptr, template_ui->prop); + DEG_relations_tag_update(bmain); } } break; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index a4546780dd9..3a1781b941a 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -3382,11 +3382,9 @@ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) if (use_add) { /* In add mode, we add relative shape key offset. */ - if (kb) { - const float *rco = CustomData_bmesh_get_n( - &em->bm->vdata, eve->head.data, CD_SHAPEKEY, kb->relative); - sub_v3_v3v3(co, co, rco); - } + const float *rco = CustomData_bmesh_get_n( + &em->bm->vdata, eve->head.data, CD_SHAPEKEY, kb->relative); + sub_v3_v3v3(co, co, rco); madd_v3_v3fl(eve->co, co, blend); } diff --git a/source/blender/editors/object/object_modes.c b/source/blender/editors/object/object_modes.c index edc2f15813c..f06b6a4db2a 100644 --- a/source/blender/editors/object/object_modes.c +++ b/source/blender/editors/object/object_modes.c @@ -282,7 +282,9 @@ static bool ed_object_mode_generic_exit_ex(struct Main *bmain, ED_object_posemode_exit_ex(bmain, ob); } } - else if ((ob->type == OB_GPENCIL) && ((ob->mode & OB_MODE_OBJECT) == 0)) { + else if (ob->type == OB_GPENCIL) { + /* Accounted for above. */ + BLI_assert((ob->mode & OB_MODE_OBJECT) == 0); if (only_test) { return true; } diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index 48c522c5e1b..1e628bbc39b 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -291,7 +291,7 @@ static int txtfmt_py_literal_numeral(const char *string, char prev_fmt) } /* Previous was a number; if immediately followed by '.' it's a floating point decimal number. * Note: keep the decimal point, it's needed to allow leading zeros. */ - if ((prev_fmt == FMT_TYPE_NUMERAL) && (first == '.')) { + if (first == '.') { return txtfmt_py_find_numeral_inner(string); } /* "Imaginary" part of a complex number ends with 'j' */ |