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>2014-06-24 18:01:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-24 18:01:33 +0400
commitc5ccbacdaac7c5b2db0bc18c1ed514fd01d7d76d (patch)
tree9cb7f2d056c030af38db0bcda3be6fb4bec49eb3
parentd19d1b549746238c4c1a694a8d3781a1fd0cf49d (diff)
move STACK_* macros into BLI_stackdefines.h
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c13
-rw-r--r--source/blender/blenlib/BLI_stackdefines.h55
-rw-r--r--source/blender/blenlib/BLI_utildefines.h28
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c1
-rw-r--r--source/blender/bmesh/operators/bmo_bisect_plane.c2
-rw-r--r--source/blender/bmesh/operators/bmo_connect.c1
-rw-r--r--source/blender/bmesh/operators/bmo_removedoubles.c4
-rw-r--r--source/blender/bmesh/operators/bmo_subdivide_edgering.c1
-rw-r--r--source/blender/bmesh/tools/bmesh_bisect_plane.c5
-rw-r--r--source/blender/modifiers/intern/MOD_laplaciandeform.c4
-rw-r--r--source/blender/modifiers/intern/MOD_solidify.c4
12 files changed, 69 insertions, 52 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index 798633c8c56..2d7e06c7308 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -40,6 +40,7 @@
#include "BLI_blenlib.h"
#include "BLI_edgehash.h"
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
#include "BKE_pbvh.h"
#include "BKE_cdderivedmesh.h"
@@ -2770,17 +2771,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
MEM_freeN(oldv);
MEM_freeN(olde);
MEM_freeN(oldl);
- MEM_freeN(oldp);
-
- STACK_FREE(oldv);
- STACK_FREE(olde);
- STACK_FREE(oldl);
- STACK_FREE(oldp);
-
- STACK_FREE(mvert);
- STACK_FREE(medge);
- STACK_FREE(mloop);
- STACK_FREE(mpoly);
+ MEM_freeN(oldp);;
BLI_edgehash_free(ehash, NULL);
diff --git a/source/blender/blenlib/BLI_stackdefines.h b/source/blender/blenlib/BLI_stackdefines.h
new file mode 100644
index 00000000000..3a4957599d6
--- /dev/null
+++ b/source/blender/blenlib/BLI_stackdefines.h
@@ -0,0 +1,55 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BLI_STACKDEFINES_H__
+#define __BLI_STACKDEFINES_H__
+
+/** \file BLI_stackdefines.h
+ * \ingroup bli
+ */
+
+/* simple stack */
+#define STACK_DECLARE(stack) unsigned int _##stack##_index
+#define STACK_INIT(stack) ((void)stack, (void)((_##stack##_index) = 0))
+#define STACK_SIZE(stack) ((void)stack, (_##stack##_index))
+#define STACK_PUSH(stack, val) (void)((stack)[(_##stack##_index)++] = val)
+#define STACK_PUSH_RET(stack) ((void)stack, ((stack)[(_##stack##_index)++]))
+#define STACK_PUSH_RET_PTR(stack) ((void)stack, &((stack)[(_##stack##_index)++]))
+#define STACK_POP(stack) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : NULL)
+#define STACK_POP_PTR(stack) ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
+#define STACK_POP_DEFAULT(stack, r) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : r)
+/* take care, re-orders */
+#define STACK_REMOVE(stack, i) \
+ if (--_##stack##_index != i) { \
+ stack[i] = stack[_##stack##_index]; \
+ } (void)0
+#ifdef __GNUC__
+#define STACK_SWAP(stack_a, stack_b) { \
+ SWAP(typeof(stack_a), stack_a, stack_b); \
+ SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
+ } (void)0
+#else
+#define STACK_SWAP(stack_a, stack_b) { \
+ SWAP(void *, stack_a, stack_b); \
+ SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
+ } (void)0
+#endif
+
+#endif /* __BLI_STACKDEFINES_H__ */
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index c464bcdd0a9..b6bdf26d5b6 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -332,34 +332,6 @@
#define UNPACK3OP(op, a) op((a)[0]), op((a)[1]), op((a)[2])
#define UNPACK4OP(op, a) op((a)[0]), op((a)[1]), op((a)[2]), op((a)[3])
-/* simple stack */
-#define STACK_DECLARE(stack) unsigned int _##stack##_index
-#define STACK_INIT(stack) ((void)stack, (void)((_##stack##_index) = 0))
-#define STACK_SIZE(stack) ((void)stack, (_##stack##_index))
-#define STACK_PUSH(stack, val) (void)((stack)[(_##stack##_index)++] = val)
-#define STACK_PUSH_RET(stack) ((void)stack, ((stack)[(_##stack##_index)++]))
-#define STACK_PUSH_RET_PTR(stack) ((void)stack, &((stack)[(_##stack##_index)++]))
-#define STACK_POP(stack) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : NULL)
-#define STACK_POP_PTR(stack) ((_##stack##_index) ? &((stack)[--(_##stack##_index)]) : NULL)
-#define STACK_POP_DEFAULT(stack, r) ((_##stack##_index) ? ((stack)[--(_##stack##_index)]) : r)
-#define STACK_FREE(stack) ((void)stack)
-/* take care, re-orders */
-#define STACK_REMOVE(stack, i) \
- if (--_##stack##_index != i) { \
- stack[i] = stack[_##stack##_index]; \
- } (void)0
-#ifdef __GNUC__
-#define STACK_SWAP(stack_a, stack_b) { \
- SWAP(typeof(stack_a), stack_a, stack_b); \
- SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
- } (void)0
-#else
-#define STACK_SWAP(stack_a, stack_b) { \
- SWAP(void *, stack_a, stack_b); \
- SWAP(unsigned int, _##stack_a##_index, _##stack_b##_index); \
- } (void)0
-#endif
-
/* array helpers */
#define ARRAY_LAST_ITEM(arr_start, arr_dtype, tot) \
(arr_dtype *)((char *)arr_start + (sizeof(*((arr_dtype *)NULL)) * (size_t)(tot - 1)))
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index b1d41c9c5c6..812c223dcc4 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -32,6 +32,7 @@
#include "BLI_array.h"
#include "BLI_alloca.h"
#include "BLI_smallhash.h"
+#include "BLI_stackdefines.h"
#include "BLF_translation.h"
@@ -2113,8 +2114,6 @@ void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len
}
#endif
- STACK_FREE(stack);
-
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
i = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&visithash, (uintptr_t)e));
if (i == 0) {
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 61e1a15c605..d35625566c0 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -36,6 +36,7 @@
#include "BLI_math.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
+#include "BLI_stackdefines.h"
#include "bmesh.h"
#include "intern/bmesh_private.h"
diff --git a/source/blender/bmesh/operators/bmo_bisect_plane.c b/source/blender/bmesh/operators/bmo_bisect_plane.c
index 74cb9d67e88..378cf405e16 100644
--- a/source/blender/bmesh/operators/bmo_bisect_plane.c
+++ b/source/blender/bmesh/operators/bmo_bisect_plane.c
@@ -29,6 +29,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
#include "BLI_math.h"
#include "bmesh.h"
@@ -103,7 +104,6 @@ void bmo_bisect_plane_exec(BMesh *bm, BMOperator *op)
BM_vert_kill(bm, v);
}
- STACK_FREE(vert_arr);
MEM_freeN(vert_arr);
}
diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c
index 5a00401b3c7..8b0033a9342 100644
--- a/source/blender/bmesh/operators/bmo_connect.c
+++ b/source/blender/bmesh/operators/bmo_connect.c
@@ -27,6 +27,7 @@
*/
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
#include "BLI_alloca.h"
#include "BLI_linklist_stack.h"
diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c
index e837beba2c2..a17ab2133c1 100644
--- a/source/blender/bmesh/operators/bmo_removedoubles.c
+++ b/source/blender/bmesh/operators/bmo_removedoubles.c
@@ -31,6 +31,7 @@
#include "BLI_math.h"
#include "BLI_array.h"
#include "BLI_alloca.h"
+#include "BLI_stackdefines.h"
#include "BKE_customdata.h"
@@ -151,9 +152,6 @@ static void remdoubles_createface(BMesh *bm, BMFace *f, BMOpSlot *slot_targetmap
}
}
}
-
- STACK_FREE(edges);
- STACK_FREE(loops);
}
/**
diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
index 182bf0518ef..ae1ff5a7389 100644
--- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c
+++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c
@@ -40,6 +40,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
#include "BLI_alloca.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c
index fcf768bc116..0bd68e7a461 100644
--- a/source/blender/bmesh/tools/bmesh_bisect_plane.c
+++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c
@@ -38,6 +38,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
#include "BLI_alloca.h"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
@@ -275,9 +276,9 @@ static void bm_face_bisect_verts(BMesh *bm, BMFace *f, const float plane[4], con
}
}
-finally:
- STACK_FREE(vert_split_arr);
+finally:
+ (void)vert_split_arr;
}
/* -------------------------------------------------------------------- */
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index d3bd05baa6d..f613d6063fe 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -28,8 +28,9 @@
* \ingroup modifiers
*/
-#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
+#include "BLI_math.h"
#include "BLI_string.h"
#include "MEM_guardedalloc.h"
@@ -623,7 +624,6 @@ static void initSystem(LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh
memcpy(sys->index_anchors, index_anchors, sizeof(int) * total_anchors);
memcpy(sys->co, vertexCos, sizeof(float[3]) * numVerts);
MEM_freeN(index_anchors);
- STACK_FREE(index_anchors);
lmd->vertexco = MEM_mallocN(sizeof(float[3]) * numVerts, "ModDeformCoordinates");
memcpy(lmd->vertexco, vertexCos, sizeof(float[3]) * numVerts);
lmd->total_verts = numVerts;
diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c
index 7d15147a3c6..14a6b631bd6 100644
--- a/source/blender/modifiers/intern/MOD_solidify.c
+++ b/source/blender/modifiers/intern/MOD_solidify.c
@@ -35,6 +35,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
+#include "BLI_stackdefines.h"
#include "BLI_bitmap.h"
#include "BLI_math.h"
@@ -813,9 +814,6 @@ static DerivedMesh *applyModifier(
MEM_freeN(edge_order);
}
- STACK_FREE(new_vert_arr);
- STACK_FREE(new_edge_arr);
-
if (old_vert_arr)
MEM_freeN(old_vert_arr);