Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-03-15 13:48:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-03-15 13:48:35 +0300
commit4be4c06671551da62edf197df6e7ad8c89dc2fe0 (patch)
tree17592201ff98be5c4d6fbd69b9f8c102a168365e /source
parent80edc0e972a2dde85509968832ce21f46d86ce58 (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')
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c8
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c8
-rw-r--r--source/blender/editors/object/object_modes.c4
-rw-r--r--source/blender/editors/space_text/text_format_py.c2
-rw-r--r--source/blender/io/avi/intern/avi_rgb.c3
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c4
8 files changed, 15 insertions, 18 deletions
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index d14b7a51a94..b4e78453226 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -788,7 +788,7 @@ void BM_log_redo(BMesh *bm, BMLog *log)
/* Currently at the beginning of the undo stack, move to first entry */
entry = log->entries.first;
}
- else if (entry && entry->next) {
+ else if (entry->next) {
/* Move to next undo entry */
entry = entry->next;
}
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' */
diff --git a/source/blender/io/avi/intern/avi_rgb.c b/source/blender/io/avi/intern/avi_rgb.c
index d449556e79b..51aa9a6280b 100644
--- a/source/blender/io/avi/intern/avi_rgb.c
+++ b/source/blender/io/avi/intern/avi_rgb.c
@@ -97,7 +97,8 @@ void *avi_converter_from_avi_rgb(AviMovie *movie, int stream, unsigned char *buf
if (buf) {
size_t rowstride = movie->header->Width * 3;
- if ((bits != 16) && (movie->header->Width % 2)) {
+ BLI_assert(bits != 16);
+ if (movie->header->Width % 2) {
rowstride++;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 1bd98cdc996..d649b21569e 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3516,7 +3516,7 @@ static int previews_clear_exec(bContext *C, wmOperator *op)
BKE_idcode_to_idfilter(GS(id->name)) & id_filters);
#endif
- if (!id || !(BKE_idcode_to_idfilter(GS(id->name)) & id_filters)) {
+ if (!(BKE_idcode_to_idfilter(GS(id->name)) & id_filters)) {
continue;
}
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 51dccf5bb8b..ac5fd522664 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -525,9 +525,7 @@ static void build_pict_list_ex(
BLI_stringenc(filepath, fp_decoded.head, fp_decoded.tail, fp_decoded.digits, fp_framenr);
while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0))) {
- if (hasevent) {
- GHOST_DispatchEvents(g_WS.ghost_system);
- }
+ GHOST_DispatchEvents(g_WS.ghost_system);
if (ps->loading == false) {
return;
}