[Bf-blender-cvs] [4fcd8b6] master: Code Cleanup: remove redundant/misleading NULL checks

Campbell Barton noreply at git.blender.org
Mon Dec 2 23:26:30 CET 2013


Commit: 4fcd8b64da9309b668fe5d31fa6f0c1727dc3a42
Author: Campbell Barton
Date:   Tue Dec 3 09:22:29 2013 +1100
http://developer.blender.org/rB4fcd8b64da9309b668fe5d31fa6f0c1727dc3a42

Code Cleanup: remove redundant/misleading NULL checks

===================================================================

M	source/blender/blenkernel/BKE_mask.h
M	source/blender/blenkernel/intern/displist.c
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/mask.c
M	source/blender/editors/sculpt_paint/paint_vertex.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 9e7fcb4..d732490 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 3f35ced..9670a18 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 3ce44dc..232ee33 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 6097e05..b20b429 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 7e598ff..7d62ca0 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;
 					}
 				}




More information about the Bf-blender-cvs mailing list