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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-08-17 09:33:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-17 09:33:55 +0400
commitd7cc2be2b7820a0967135e6bc7043e586a0c0dd3 (patch)
treec1af1177aabb87b711afd770985a614d7de314f7 /source/blender/bmesh/operators/bmo_normals.c
parent26334888774fcfe28efe12d42d1da69001fa9137 (diff)
add linklist stack macros, use where over allocating an array was previously done.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_normals.c')
-rw-r--r--source/blender/bmesh/operators/bmo_normals.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/bmesh/operators/bmo_normals.c b/source/blender/bmesh/operators/bmo_normals.c
index b645766178d..93d7d1ad2c0 100644
--- a/source/blender/bmesh/operators/bmo_normals.c
+++ b/source/blender/bmesh/operators/bmo_normals.c
@@ -29,6 +29,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
+#include "BLI_linklist_stack.h"
#include "bmesh.h"
@@ -65,8 +66,7 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
float f_len_best;
BMFace *f;
- BMFace **fstack = MEM_mallocN(sizeof(*fstack) * faces_len, __func__);
- STACK_DECLARE(fstack);
+ BLI_LINKSTACK_DECLARE(fstack, BMFace *);
zero_v3(cent);
@@ -103,12 +103,12 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
* have the same winding. this is done recursively, using a manual
* stack (if we use simple function recursion, we'd end up overloading
* the stack on large meshes). */
- STACK_INIT(fstack);
+ BLI_LINKSTACK_INIT(fstack);
- STACK_PUSH(fstack, faces[f_start_index]);
+ BLI_LINKSTACK_PUSH(fstack, faces[f_start_index]);
BMO_elem_flag_enable(bm, faces[f_start_index], FACE_TEMP);
- while ((f = STACK_POP(fstack))) {
+ while ((f = BLI_LINKSTACK_POP(fstack))) {
const bool flip_state = BMO_elem_flag_test_bool(bm, f, FACE_FLIP);
BMLoop *l_iter, *l_first;
@@ -120,13 +120,13 @@ static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int f
if (!BMO_elem_flag_test(bm, l_other->f, FACE_TEMP)) {
BMO_elem_flag_enable(bm, l_other->f, FACE_TEMP);
BMO_elem_flag_set(bm, l_other->f, FACE_FLIP, (l_other->v == l_iter->v) != flip_state);
- STACK_PUSH(fstack, l_other->f);
+ BLI_LINKSTACK_PUSH(fstack, l_other->f);
}
}
} while ((l_iter = l_iter->next) != l_first);
}
- MEM_freeN(fstack);
+ BLI_LINKSTACK_FREE(fstack);
/* apply flipping to oflag'd faces */
for (i = 0; i < faces_len; i++) {