[Bf-blender-cvs] [6f3957770d] surface-deform-modifier: Review: Fix indentations and use MEM_SAFE_FREE

Luca Rood noreply at git.blender.org
Wed Jan 25 07:08:07 CET 2017


Commit: 6f3957770d2e427967ae65d0a438d58a1c840e1c
Author: Luca Rood
Date:   Mon Jan 23 20:56:19 2017 -0200
Branches: surface-deform-modifier
https://developer.blender.org/rB6f3957770d2e427967ae65d0a438d58a1c840e1c

Review: Fix indentations and use MEM_SAFE_FREE

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

M	source/blender/modifiers/intern/MOD_surfacedeform.c

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

diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index b20c21d97a..f9791f3361 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -78,9 +78,9 @@ typedef struct SDefBindWeightData {
 static void initData(ModifierData *md)
 {
 	SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *) md;
-	smd->target	 = NULL;
-	smd->verts	 = NULL;
-	smd->flags   = 0;
+	smd->target = NULL;
+	smd->verts = NULL;
+	smd->flags = 0;
 	smd->falloff = 4.0f;
 }
 
@@ -92,13 +92,8 @@ static void freeData(ModifierData *md)
 		for (int i = 0; i < smd->numverts; i++) {
 			if (smd->verts[i].binds) {
 				for (int j = 0; j < smd->verts[i].numbinds; j++) {
-					if (smd->verts[i].binds[j].vert_inds) {
-						MEM_freeN(smd->verts[i].binds[j].vert_inds);
-					}
-
-					if (smd->verts[i].binds[j].vert_weights) {
-						MEM_freeN(smd->verts[i].binds[j].vert_weights);
-					}
+					MEM_SAFE_FREE(smd->verts[i].binds[j].vert_inds);
+					MEM_SAFE_FREE(smd->verts[i].binds[j].vert_weights);
 				}
 
 				MEM_freeN(smd->verts[i].binds);
@@ -351,13 +346,8 @@ static void freeBindData(SDefBindWeightData * const bwdata)
 	for (bpoly = bwdata->bind_polys; bpoly; bpoly = bwdata->bind_polys) {
 		bwdata->bind_polys = bpoly->next;
 
-		if (bpoly->coords) {
-			MEM_freeN(bpoly->coords);
-		}
-
-		if (bpoly->coords_v2) {
-			MEM_freeN(bpoly->coords_v2);
-		}
+		MEM_SAFE_FREE(bpoly->coords);
+		MEM_SAFE_FREE(bpoly->coords_v2);
 
 		MEM_freeN(bpoly);
 	}




More information about the Bf-blender-cvs mailing list