From 4fcd8b64da9309b668fe5d31fa6f0c1727dc3a42 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 3 Dec 2013 09:22:29 +1100 Subject: Code Cleanup: remove redundant/misleading NULL checks --- source/blender/blenkernel/BKE_mask.h | 2 +- source/blender/blenkernel/intern/displist.c | 3 +-- source/blender/blenkernel/intern/gpencil.c | 6 +----- source/blender/blenkernel/intern/mask.c | 6 +----- source/blender/editors/sculpt_paint/paint_vertex.c | 7 ++++--- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 9e7fcb4b2a7..d73249041e8 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -158,7 +158,7 @@ struct MaskLayerShape *BKE_mask_layer_shape_alloc(struct MaskLayer *masklay, con void BKE_mask_layer_shape_free(struct MaskLayerShape *masklay_shape); struct MaskLayerShape *BKE_mask_layer_shape_verify_frame(struct MaskLayer *masklay, const int frame); struct MaskLayerShape *BKE_mask_layer_shape_duplicate(struct MaskLayerShape *masklay_shape); -bool BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape); +void BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape); void BKE_mask_layer_shape_sort(struct MaskLayer *masklay); bool BKE_mask_layer_shape_spline_from_index(struct MaskLayer *masklay, int index, diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index 3f35ced3550..9670a1892b0 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -1179,8 +1179,7 @@ static void curve_calc_orcodm(Scene *scene, Object *ob, DerivedMesh *derivedFina /* add an orco layer if needed */ add_orco_dm(ob, derivedFinal, orcodm); - if (orcodm) - orcodm->release(orcodm); + orcodm->release(orcodm); } void BKE_displist_make_surf(Scene *scene, Object *ob, ListBase *dispbase, diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index 3ce44dcb1f1..232ee335fbb 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -62,11 +62,7 @@ bool free_gpencil_strokes(bGPDframe *gpf) { bGPDstroke *gps, *gpsn; bool changed = (gpf->strokes.first != NULL); - - /* error checking */ - if (gpf == NULL) - return false; - + /* free strokes */ for (gps = gpf->strokes.first; gps; gps = gpsn) { gpsn = gps->next; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 6097e05d91d..b20b4294f84 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1813,15 +1813,11 @@ MaskLayerShape *BKE_mask_layer_shape_duplicate(MaskLayerShape *masklay_shape) return masklay_shape_copy; } -bool BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape) +void BKE_mask_layer_shape_unlink(MaskLayer *masklay, MaskLayerShape *masklay_shape) { - bool changed = (masklay_shape != NULL); - BLI_remlink(&masklay->splines_shapes, masklay_shape); BKE_mask_layer_shape_free(masklay_shape); - - return changed; } static int mask_layer_shape_sort_cb(void *masklay_shape_a_ptr, void *masklay_shape_b_ptr) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 7e598ff788b..7d62ca0535d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2366,12 +2366,13 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P else totindex = 0; } - if (use_face_sel && me->mpoly) { + if (use_face_sel && me->totpoly) { + MPoly *mpoly = me->mpoly; for (index = 0; index < totindex; index++) { if (indexar[index] && indexar[index] <= me->totpoly) { - MPoly *mpoly = ((MPoly *)me->mpoly) + (indexar[index] - 1); + MPoly *mp = &mpoly[indexar[index] - 1]; - if ((mpoly->flag & ME_FACE_SEL) == 0) { + if ((mp->flag & ME_FACE_SEL) == 0) { indexar[index] = 0; } } -- cgit v1.2.3