[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60144] trunk/blender/source/blender/ blenkernel/intern/customdata.c: use stack memory for deform weight interpolation.

Campbell Barton ideasman42 at gmail.com
Sun Sep 15 07:17:19 CEST 2013


Revision: 60144
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60144
Author:   campbellbarton
Date:     2013-09-15 05:17:19 +0000 (Sun, 15 Sep 2013)
Log Message:
-----------
use stack memory for deform weight interpolation.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/customdata.c

Modified: trunk/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/customdata.c	2013-09-15 01:47:40 UTC (rev 60143)
+++ trunk/blender/source/blender/blenkernel/intern/customdata.c	2013-09-15 05:17:19 UTC (rev 60144)
@@ -45,11 +45,12 @@
 #include "DNA_ID.h"
 
 #include "BLI_utildefines.h"
-#include "BLI_blenlib.h"
-#include "BLI_linklist.h"
+#include "BLI_string.h"
+#include "BLI_path_util.h"
 #include "BLI_math.h"
 #include "BLI_mempool.h"
 #include "BLI_utildefines.h"
+#include "BLI_alloca.h"
 
 #include "BLF_translation.h"
 
@@ -256,7 +257,7 @@
 
 			/* if this def_nr is not in the list, add it */
 			if (!node) {
-				struct MDeformWeight_Link *tmp_dwlink = MEM_mallocN(sizeof(*tmp_dwlink), __func__);
+				struct MDeformWeight_Link *tmp_dwlink = alloca(sizeof(*tmp_dwlink));
 				tmp_dwlink->dw.def_nr = dw->def_nr;
 				tmp_dwlink->dw.weight = weight;
 
@@ -286,12 +287,9 @@
 	}
 
 	if (totweight) {
-		struct MDeformWeight_Link *node_next;
 		dvert->totweight = totweight;
-		for (i = 0, node = dest_dwlink; node; node = node_next, i++) {
-			node_next = node->next;
+		for (i = 0, node = dest_dwlink; node; node = node->next, i++) {
 			dvert->dw[i] = node->dw;
-			MEM_freeN(node);
 		}
 	}
 	else {




More information about the Bf-blender-cvs mailing list