From 4982f200fadd15bb733128ae03ed737549e2657c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 28 Jul 2013 10:38:25 +0000 Subject: move alloca define into its own header since its not related to BLI_array --- source/blender/blenkernel/intern/DerivedMesh.c | 1 - source/blender/blenkernel/intern/anim_sys.c | 2 +- source/blender/blenkernel/intern/cdderivedmesh.c | 1 - source/blender/blenkernel/intern/mesh.c | 1 + source/blender/blenkernel/intern/modifiers_bmesh.c | 6 ++--- source/blender/blenlib/BLI_array.h | 27 ---------------------- source/blender/blenlib/CMakeLists.txt | 1 + source/blender/bmesh/intern/bmesh_construct.c | 2 +- source/blender/bmesh/intern/bmesh_core.c | 9 ++++---- source/blender/bmesh/intern/bmesh_interp.c | 2 +- source/blender/bmesh/intern/bmesh_mesh_conv.c | 2 +- source/blender/bmesh/intern/bmesh_operators.c | 1 - source/blender/bmesh/intern/bmesh_polygon.c | 2 +- source/blender/bmesh/intern/bmesh_queries.c | 2 +- source/blender/bmesh/operators/bmo_connect.c | 2 +- source/blender/bmesh/operators/bmo_dupe.c | 2 +- source/blender/bmesh/operators/bmo_fill_holes.c | 2 +- .../bmesh/operators/bmo_subdivide_edgering.c | 2 +- source/blender/bmesh/operators/bmo_utils.c | 2 +- source/blender/bmesh/tools/bmesh_bevel.c | 1 + source/blender/bmesh/tools/bmesh_triangulate.c | 2 +- source/blender/editors/mesh/editmesh_knife.c | 1 + source/blender/editors/mesh/editmesh_utils.c | 2 +- source/blender/editors/mesh/mesh_data.c | 2 +- .../editors/transform/transform_conversions.c | 1 - source/blender/editors/uvedit/uvedit_draw.c | 1 - source/blender/editors/uvedit/uvedit_ops.c | 3 ++- .../blender/editors/uvedit/uvedit_parametrizer.c | 6 ++--- source/blender/editors/uvedit/uvedit_unwrap_ops.c | 2 +- source/blender/makesrna/intern/rna_mesh.c | 1 - source/blender/modifiers/intern/MOD_mirror.c | 1 - 31 files changed, 31 insertions(+), 61 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 7a7d4c7d24a..3422f783eeb 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -46,7 +46,6 @@ #include "BLI_blenlib.h" #include "BLI_math.h" #include "BLI_memarena.h" -#include "BLI_array.h" #include "BLI_utildefines.h" #include "BLI_linklist.h" diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 001964087b8..4b05b0800a5 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -39,8 +39,8 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_array.h" #include "BLI_blenlib.h" +#include "BLI_alloca.h" #include "BLI_dynstr.h" #include "BLF_translation.h" diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 0e294f38838..60f6bb0a736 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -40,7 +40,6 @@ #include "BLI_blenlib.h" #include "BLI_edgehash.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_smallhash.h" #include "BLI_utildefines.h" #include "BLI_scanfill.h" diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 439965420f7..095957b40d5 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -51,6 +51,7 @@ #include "BLI_bitmap.h" #include "BLI_scanfill.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BKE_animsys.h" #include "BKE_main.h" diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index a94daed11e3..290b0684e40 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -28,13 +28,13 @@ * \ingroup bke */ -#include "BLI_math.h" - #include "MEM_guardedalloc.h" +#include "BLI_math.h" +#include "BLI_alloca.h" + #include "DNA_object_types.h" -#include "BLI_array.h" #include "BKE_DerivedMesh.h" #include "BKE_editmesh.h" diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 252b37d9aae..c7b8521f9fa 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -173,31 +173,4 @@ void _bli_array_grow_func(void **arr_p, const void *arr_static, MEM_freeN(arr); \ } (void)0 - -/* alloca */ -#ifdef _MSC_VER -# define alloca _alloca -#endif - -#if defined(__MINGW32__) -# include /* mingw needs for alloca() */ -#endif - -#if defined(__GNUC__) || defined(__clang__) -#define BLI_array_alloca(arr, realsize) \ - (typeof(arr))alloca(sizeof(*arr) * (realsize)) - -#define BLI_array_alloca_and_count(arr, realsize) \ - (typeof(arr))alloca(sizeof(*arr) * (realsize)); \ - const int _##arr##_count = (realsize) - -#else -#define BLI_array_alloca(arr, realsize) \ - alloca(sizeof(*arr) * (realsize)) - -#define BLI_array_alloca_and_count(arr, realsize) \ - alloca(sizeof(*arr) * (realsize)); \ - const int _##arr##_count = (realsize) -#endif - #endif /* __BLI_ARRAY_H__ */ diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 1d94ca9afbc..b6b69116e67 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -99,6 +99,7 @@ set(SRC intern/winstuff.c BLI_args.h + BLI_alloca.h BLI_array.h BLI_bitmap.h BLI_blenlib.h diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 4d3653b1a82..1f7ace1ba6d 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -33,7 +33,7 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BKE_customdata.h" diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index eac4b304b12..f9e711a0dc3 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -30,6 +30,7 @@ #include "BLI_math_vector.h" #include "BLI_listbase.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_smallhash.h" #include "BLF_translation.h" @@ -594,7 +595,7 @@ static void bm_kill_only_loop(BMesh *bm, BMLoop *l) */ void BM_face_edges_kill(BMesh *bm, BMFace *f) { - BMEdge **edges = BLI_array_alloca_and_count(edges, f->len); + BMEdge **edges = BLI_array_alloca(edges, f->len); BMLoop *l_iter; BMLoop *l_first; int i = 0; @@ -604,7 +605,7 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f) edges[i++] = l_iter->e; } while ((l_iter = l_iter->next) != l_first); - for (i = 0; i < BLI_array_count(edges); i++) { + for (i = 0; i < f->len; i++) { BM_edge_kill(bm, edges[i]); } } @@ -615,7 +616,7 @@ void BM_face_edges_kill(BMesh *bm, BMFace *f) */ void BM_face_verts_kill(BMesh *bm, BMFace *f) { - BMVert **verts = BLI_array_alloca_and_count(verts, f->len); + BMVert **verts = BLI_array_alloca(verts, f->len); BMLoop *l_iter; BMLoop *l_first; int i = 0; @@ -625,7 +626,7 @@ void BM_face_verts_kill(BMesh *bm, BMFace *f) verts[i++] = l_iter->v; } while ((l_iter = l_iter->next) != l_first); - for (i = 0; i < BLI_array_count(verts); i++) { + for (i = 0; i < f->len; i++) { BM_vert_kill(bm, verts[i]); } } diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 446d32de5d2..3e8a49a01fc 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -36,7 +36,7 @@ #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BKE_customdata.h" diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 184fed59f01..81d4aad0fdf 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -84,7 +84,7 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math_vector.h" #include "BKE_mesh.h" diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index e0268d6b504..269501e1f02 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -34,7 +34,6 @@ #include "BLI_memarena.h" #include "BLI_mempool.h" #include "BLI_listbase.h" -#include "BLI_array.h" #include "BLF_translation.h" diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 1ecb3c2b9ac..297458eb1d6 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -32,8 +32,8 @@ #include "MEM_guardedalloc.h" +#include "BLI_alloca.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_scanfill.h" #include "BLI_listbase.h" diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index 9dc5ae61d61..de601b19052 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -33,8 +33,8 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" #include "BLI_math.h" +#include "BLI_alloca.h" #include "bmesh.h" #include "intern/bmesh_private.h" diff --git a/source/blender/bmesh/operators/bmo_connect.c b/source/blender/bmesh/operators/bmo_connect.c index 50588ad70a9..c718cac4bd6 100644 --- a/source/blender/bmesh/operators/bmo_connect.c +++ b/source/blender/bmesh/operators/bmo_connect.c @@ -29,8 +29,8 @@ #include "MEM_guardedalloc.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 59e018eccf1..f9ff308b706 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -28,8 +28,8 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" #include "BLI_math.h" +#include "BLI_alloca.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_fill_holes.c b/source/blender/bmesh/operators/bmo_fill_holes.c index dca86445219..40a682e790d 100644 --- a/source/blender/bmesh/operators/bmo_fill_holes.c +++ b/source/blender/bmesh/operators/bmo_fill_holes.c @@ -29,7 +29,7 @@ #include "MEM_guardedalloc.h" #include "BLI_listbase.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "bmesh.h" diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c index f69d2f27346..9cc418d61ed 100644 --- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c +++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c @@ -40,7 +40,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_listbase.h" diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 85bd8a85376..fb1e8ec6a17 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -32,8 +32,8 @@ #include "DNA_meshdata_types.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BLI_heap.h" +#include "BLI_alloca.h" #include "BKE_customdata.h" diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 6431b6b7cf5..02f0251bff2 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -34,6 +34,7 @@ #include "DNA_meshdata_types.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_memarena.h" diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c index 79f6c76afc7..2eacf62d68a 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.c +++ b/source/blender/bmesh/tools/bmesh_triangulate.c @@ -30,7 +30,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "bmesh.h" diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 9440a67c7f4..d61f6712a8f 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -38,6 +38,7 @@ #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_array.h" +#include "BLI_alloca.h" #include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_smallhash.h" diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 3a3a734eef0..44cc89cb23c 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -35,7 +35,7 @@ #include "DNA_object_types.h" #include "BLI_math.h" -#include "BLI_array.h" +#include "BLI_alloca.h" #include "BKE_DerivedMesh.h" #include "BKE_context.h" diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 52a8ccc4aab..e8cbf0926d4 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -37,8 +37,8 @@ #include "DNA_view3d_types.h" #include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_path_util.h" -#include "BLI_array.h" #include "BLI_math.h" #include "BKE_context.h" diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index e44b9620b6f..c2ca8cd46b6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -59,7 +59,6 @@ #include "BLI_math.h" #include "BLI_blenlib.h" -#include "BLI_array.h" #include "BLI_utildefines.h" #include "BLI_smallhash.h" diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index ef22f4a484c..a873702b5b8 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -49,7 +49,6 @@ #include "BKE_mesh.h" #include "BKE_editmesh.h" -#include "BLI_array.h" #include "BLI_buffer.h" #include "BIF_gl.h" diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 0f7caf126d3..0b514e3f6fd 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -46,11 +46,12 @@ #include "DNA_space_types.h" #include "DNA_scene_types.h" +#include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_lasso.h" #include "BLI_blenlib.h" #include "BLI_array.h" -#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_customdata.h" diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 18f4e8cafaf..7851eebe269 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -26,15 +26,13 @@ #include "MEM_guardedalloc.h" -#include "BLI_array.h" +#include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_memarena.h" #include "BLI_math.h" #include "BLI_rand.h" #include "BLI_heap.h" #include "BLI_boxpack2d.h" -#include "BLI_utildefines.h" - - #include "ONL_opennl.h" diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index a100757980c..af6689e3f6d 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -44,6 +44,7 @@ #include "DNA_modifier_types.h" #include "BLI_utildefines.h" +#include "BLI_alloca.h" #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_uvproject.h" @@ -65,7 +66,6 @@ #include "BLI_math.h" #include "BLI_edgehash.h" #include "BLI_scanfill.h" -#include "BLI_array.h" #include "BLI_uvproject.h" #include "PIL_time.h" diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 51aad755e77..35d8a0fb433 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -37,7 +37,6 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" -#include "BLI_array.h" #include "BLI_math_base.h" #include "BLI_math_rotation.h" #include "BLI_utildefines.h" diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c index d50e69217f6..1b9fcd9f34e 100644 --- a/source/blender/modifiers/intern/MOD_mirror.c +++ b/source/blender/modifiers/intern/MOD_mirror.c @@ -37,7 +37,6 @@ #include "DNA_object_types.h" #include "BLI_math.h" -#include "BLI_array.h" #include "BKE_cdderivedmesh.h" #include "BKE_mesh.h" -- cgit v1.2.3