diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-14 02:17:33 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-14 05:00:24 +0300 |
commit | 576142dc85c78ced792e3440a7665ea57e45a0cc (patch) | |
tree | 4b37d4897683f23a4f42ea476751cf9ed732e4de /source | |
parent | c6e956bbb148b80cbe03d59198f8257062434cff (diff) |
Cleanup: pass the sizeof(..) as the second arg for array allocation
By argument naming and convention this is the intended argument order.
Diffstat (limited to 'source')
23 files changed, 56 insertions, 56 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 92b0db5b214..cbdcf43c039 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -1383,7 +1383,7 @@ static void nlaevalchan_get_default_values(NlaEvalChannel *nec, float *r_values) switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - tmp_bool = MEM_malloc_arrayN(sizeof(*tmp_bool), length, __func__); + tmp_bool = MEM_malloc_arrayN(length, sizeof(*tmp_bool), __func__); RNA_property_boolean_get_default_array(ptr, prop, tmp_bool); for (int i = 0; i < length; i++) { r_values[i] = (float)tmp_bool[i]; @@ -1391,7 +1391,7 @@ static void nlaevalchan_get_default_values(NlaEvalChannel *nec, float *r_values) MEM_freeN(tmp_bool); break; case PROP_INT: - tmp_int = MEM_malloc_arrayN(sizeof(*tmp_int), length, __func__); + tmp_int = MEM_malloc_arrayN(length, sizeof(*tmp_int), __func__); RNA_property_int_get_default_array(ptr, prop, tmp_int); for (int i = 0; i < length; i++) { r_values[i] = (float)tmp_int[i]; diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index a86f436185e..e8a3db11219 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1495,13 +1495,13 @@ static void allocate_bbone_cache(bPoseChannel *pchan, int segments) runtime->bbone_segments = segments; runtime->bbone_rest_mats = MEM_malloc_arrayN( - sizeof(Mat4), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_rest_mats"); + 1 + (uint)segments, sizeof(Mat4), "bPoseChannel_Runtime::bbone_rest_mats"); runtime->bbone_pose_mats = MEM_malloc_arrayN( - sizeof(Mat4), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_pose_mats"); + 1 + (uint)segments, sizeof(Mat4), "bPoseChannel_Runtime::bbone_pose_mats"); runtime->bbone_deform_mats = MEM_malloc_arrayN( - sizeof(Mat4), 2 + (uint)segments, "bPoseChannel_Runtime::bbone_deform_mats"); + 2 + (uint)segments, sizeof(Mat4), "bPoseChannel_Runtime::bbone_deform_mats"); runtime->bbone_dual_quats = MEM_malloc_arrayN( - sizeof(DualQuat), 1 + (uint)segments, "bPoseChannel_Runtime::bbone_dual_quats"); + 1 + (uint)segments, sizeof(DualQuat), "bPoseChannel_Runtime::bbone_dual_quats"); } } diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c index f9437eeaffa..af721412472 100644 --- a/source/blender/blenkernel/intern/lattice_deform.c +++ b/source/blender/blenkernel/intern/lattice_deform.c @@ -115,7 +115,7 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob defgrp_index = BKE_id_defgroup_name_index(<->id, lt->vgroup); if (defgrp_index != -1) { - lattice_weights = MEM_malloc_arrayN(sizeof(float), num_points, "lattice_weights"); + lattice_weights = MEM_malloc_arrayN(num_points, sizeof(float), "lattice_weights"); for (int index = 0; index < num_points; index++) { lattice_weights[index] = BKE_defvert_find_weight(dvert + index, defgrp_index); } diff --git a/source/blender/blenkernel/intern/lattice_deform_test.cc b/source/blender/blenkernel/intern/lattice_deform_test.cc index a7cd5c36ec2..bface94d9d4 100644 --- a/source/blender/blenkernel/intern/lattice_deform_test.cc +++ b/source/blender/blenkernel/intern/lattice_deform_test.cc @@ -44,7 +44,7 @@ static void test_lattice_deform_init(LatticeDeformTestContext *ctx, int32_t num_items) { /* Generate random input data between -5 and 5. */ - ctx->coords = (float(*)[3])MEM_malloc_arrayN(sizeof(float[3]), num_items, __func__); + ctx->coords = (float(*)[3])MEM_malloc_arrayN(num_items, sizeof(float[3]), __func__); for (uint32_t index = 0; index < num_items; index++) { ctx->coords[index][0] = (rng->get_float() - 0.5f) * 10; ctx->coords[index][1] = (rng->get_float() - 0.5f) * 10; diff --git a/source/blender/blenkernel/intern/mesh_fair.cc b/source/blender/blenkernel/intern/mesh_fair.cc index 6ac1aa9b2b9..50db1bc1564 100644 --- a/source/blender/blenkernel/intern/mesh_fair.cc +++ b/source/blender/blenkernel/intern/mesh_fair.cc @@ -293,8 +293,8 @@ class BMeshFairingContext : public FairingContext { } bmloop_.reserve(bm->totloop); - vlmap_ = (MeshElemMap *)MEM_calloc_arrayN(sizeof(MeshElemMap), bm->totvert, "bmesh loop map"); - vlmap_mem_ = (int *)MEM_malloc_arrayN(sizeof(int), bm->totloop, "bmesh loop map mempool"); + vlmap_ = (MeshElemMap *)MEM_calloc_arrayN(bm->totvert, sizeof(MeshElemMap), "bmesh loop map"); + vlmap_mem_ = (int *)MEM_malloc_arrayN(bm->totloop, sizeof(int), "bmesh loop map mempool"); BMVert *v; BMLoop *l; diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index eaa11a6683a..dc418545e23 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1496,7 +1496,7 @@ void multires_topology_changed(Mesh *me) if (!mdisp->totdisp || !mdisp->disps) { if (grid) { mdisp->totdisp = grid; - mdisp->disps = MEM_calloc_arrayN(sizeof(float[3]), mdisp->totdisp, "mdisp topology"); + mdisp->disps = MEM_calloc_arrayN(mdisp->totdisp, sizeof(float[3]), "mdisp topology"); } continue; diff --git a/source/blender/blenkernel/intern/multires_reshape_smooth.c b/source/blender/blenkernel/intern/multires_reshape_smooth.c index 9fb158d2f84..3665d01926b 100644 --- a/source/blender/blenkernel/intern/multires_reshape_smooth.c +++ b/source/blender/blenkernel/intern/multires_reshape_smooth.c @@ -271,7 +271,7 @@ static void base_surface_grids_allocate(MultiresReshapeSmoothContext *reshape_sm for (int grid_index = 0; grid_index < num_grids; ++grid_index) { surface_grid[grid_index].points = MEM_calloc_arrayN( - sizeof(SurfacePoint), grid_area, "delta grid displacement"); + grid_area, sizeof(SurfacePoint), "delta grid displacement"); } reshape_smooth_context->base_surface_grids = surface_grid; @@ -576,19 +576,19 @@ static bool foreach_topology_info(const SubdivForeachContext *foreach_context, /* NOTE: Calloc so the counters are re-set to 0 "for free". */ reshape_smooth_context->geometry.num_vertices = num_vertices; reshape_smooth_context->geometry.vertices = MEM_calloc_arrayN( - sizeof(Vertex), num_vertices, "smooth vertices"); + num_vertices, sizeof(Vertex), "smooth vertices"); reshape_smooth_context->geometry.max_edges = max_edges; reshape_smooth_context->geometry.edges = MEM_malloc_arrayN( - sizeof(Edge), max_edges, "smooth edges"); + max_edges, sizeof(Edge), "smooth edges"); reshape_smooth_context->geometry.num_corners = num_loops; reshape_smooth_context->geometry.corners = MEM_malloc_arrayN( - sizeof(Corner), num_loops, "smooth corners"); + num_loops, sizeof(Corner), "smooth corners"); reshape_smooth_context->geometry.num_faces = num_polygons; reshape_smooth_context->geometry.faces = MEM_malloc_arrayN( - sizeof(Face), num_polygons, "smooth faces"); + num_polygons, sizeof(Face), "smooth faces"); return true; } diff --git a/source/blender/blenkernel/intern/multires_reshape_util.c b/source/blender/blenkernel/intern/multires_reshape_util.c index 8fb406e54a5..79a2b9eb002 100644 --- a/source/blender/blenkernel/intern/multires_reshape_util.c +++ b/source/blender/blenkernel/intern/multires_reshape_util.c @@ -86,7 +86,7 @@ static void context_init_lookup(MultiresReshapeContext *reshape_context) const int num_faces = base_mesh->totpoly; reshape_context->face_start_grid_index = MEM_malloc_arrayN( - sizeof(int), num_faces, "face_start_grid_index"); + num_faces, sizeof(int), "face_start_grid_index"); int num_grids = 0; int num_ptex_faces = 0; for (int face_index = 0; face_index < num_faces; ++face_index) { @@ -97,9 +97,9 @@ static void context_init_lookup(MultiresReshapeContext *reshape_context) } reshape_context->grid_to_face_index = MEM_malloc_arrayN( - sizeof(int), num_grids, "grid_to_face_index"); + num_grids, sizeof(int), "grid_to_face_index"); reshape_context->ptex_start_grid_index = MEM_malloc_arrayN( - sizeof(int), num_ptex_faces, "ptex_start_grid_index"); + num_ptex_faces, sizeof(int), "ptex_start_grid_index"); for (int face_index = 0, grid_index = 0, ptex_index = 0; face_index < num_faces; ++face_index) { const int num_corners = mpoly[face_index].totloop; const int num_face_ptex_faces = (num_corners == 4) ? 1 : num_corners; diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c index 501e3f27389..643e1a50fd5 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.c +++ b/source/blender/blenkernel/intern/multires_unsubdivide.c @@ -177,7 +177,7 @@ static bool is_vertex_diagonal(BMVert *from_v, BMVert *to_v) */ static void unsubdivide_face_center_vertex_tag(BMesh *bm, BMVert *initial_vertex) { - bool *visited_vertices = MEM_calloc_arrayN(sizeof(bool), bm->totvert, "visited vertices"); + bool *visited_vertices = MEM_calloc_arrayN(bm->totvert, sizeof(bool), "visited vertices"); GSQueue *queue; queue = BLI_gsqueue_new(sizeof(BMVert *)); @@ -368,7 +368,7 @@ static bool unsubdivide_tag_disconnected_mesh_element(BMesh *bm, int *elem_id, i */ static int unsubdivide_init_elem_ids(BMesh *bm, int *elem_id) { - bool *visited_vertices = MEM_calloc_arrayN(sizeof(bool), bm->totvert, "visited vertices"); + bool *visited_vertices = MEM_calloc_arrayN(bm->totvert, sizeof(bool), "visited vertices"); int current_id = 0; for (int i = 0; i < bm->totvert; i++) { if (!visited_vertices[i]) { @@ -475,7 +475,7 @@ static bool multires_unsubdivide_single_level(BMesh *bm) BM_mesh_elem_table_ensure(bm, BM_VERT); /* Build disconnected elements IDs. Each disconnected mesh element is evaluated separately. */ - int *elem_id = MEM_calloc_arrayN(sizeof(int), bm->totvert, " ELEM ID"); + int *elem_id = MEM_calloc_arrayN(bm->totvert, sizeof(int), " ELEM ID"); const int tot_ids = unsubdivide_init_elem_ids(bm, elem_id); bool valid_tag_found = true; @@ -961,7 +961,7 @@ static void multires_unsubdivide_prepare_original_bmesh_for_extract( } /* Create a map from loop index to poly index for the original mesh. */ - context->loop_to_face_map = MEM_calloc_arrayN(sizeof(int), original_mesh->totloop, "loop map"); + context->loop_to_face_map = MEM_calloc_arrayN(original_mesh->totloop, sizeof(int), "loop map"); for (int i = 0; i < original_mesh->totpoly; i++) { MPoly *poly = &original_mesh->mpoly[i]; @@ -1005,13 +1005,13 @@ static void multires_unsubdivide_extract_grids(MultiresUnsubdivideContext *conte context->num_grids = base_mesh->totloop; context->base_mesh_grids = MEM_calloc_arrayN( - sizeof(MultiresUnsubdivideGrid), base_mesh->totloop, "grids"); + base_mesh->totloop, sizeof(MultiresUnsubdivideGrid), "grids"); /* Based on the existing indices in the data-layers, generate two vertex indices maps. */ /* From vertex index in original to vertex index in base and from vertex index in base to vertex * index in original. */ - int *orig_to_base_vmap = MEM_calloc_arrayN(sizeof(int), bm_original_mesh->totvert, "orig vmap"); - int *base_to_orig_vmap = MEM_calloc_arrayN(sizeof(int), base_mesh->totvert, "base vmap"); + int *orig_to_base_vmap = MEM_calloc_arrayN(bm_original_mesh->totvert, sizeof(int), "orig vmap"); + int *base_to_orig_vmap = MEM_calloc_arrayN(base_mesh->totvert, sizeof(int), "base vmap"); context->base_to_orig_vmap = CustomData_get_layer_named(&base_mesh->vdata, CD_PROP_INT32, vname); for (int i = 0; i < base_mesh->totvert; i++) { diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 07c4e8c2316..c7c77b83e25 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -1062,7 +1062,7 @@ static void subdiv_ccg_average_grids_boundary(SubdivCCG *subdiv_ccg, } if (tls->accumulators == NULL) { tls->accumulators = MEM_calloc_arrayN( - sizeof(GridElementAccumulator), grid_size2, "average accumulators"); + grid_size2, sizeof(GridElementAccumulator), "average accumulators"); } else { for (int i = 1; i < grid_size2 - 1; i++) { @@ -1972,7 +1972,7 @@ const int *BKE_subdiv_ccg_start_face_grid_index_ensure(SubdivCCG *subdiv_ccg) const int num_coarse_faces = topology_refiner->getNumFaces(topology_refiner); subdiv_ccg->cache_.start_face_grid_index = MEM_malloc_arrayN( - sizeof(int), num_coarse_faces, "start_face_grid_index"); + num_coarse_faces, sizeof(int), "start_face_grid_index"); int start_grid_index = 0; for (int face_index = 0; face_index < num_coarse_faces; face_index++) { diff --git a/source/blender/blenkernel/intern/subdiv_deform.c b/source/blender/blenkernel/intern/subdiv_deform.c index 2c900fbd600..7a2d639e4e5 100644 --- a/source/blender/blenkernel/intern/subdiv_deform.c +++ b/source/blender/blenkernel/intern/subdiv_deform.c @@ -69,7 +69,7 @@ static void subdiv_mesh_prepare_accumulator(SubdivDeformContext *ctx, int num_ve return; } ctx->accumulated_counters = MEM_calloc_arrayN( - sizeof(*ctx->accumulated_counters), num_vertices, "subdiv accumulated counters"); + num_vertices, sizeof(*ctx->accumulated_counters), "subdiv accumulated counters"); } static void subdiv_mesh_context_free(SubdivDeformContext *ctx) diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c index 01bccab1bbd..29e7d0a1a3c 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_mesh.c @@ -108,9 +108,9 @@ static void subdiv_mesh_prepare_accumulator(SubdivMeshContext *ctx, int num_vert /* TODO(sergey): Technically, this is overallocating, we don't need memory * for an inner subdivision vertices. */ ctx->accumulated_normals = MEM_calloc_arrayN( - sizeof(*ctx->accumulated_normals), num_vertices, "subdiv accumulated normals"); + num_vertices, sizeof(*ctx->accumulated_normals), "subdiv accumulated normals"); ctx->accumulated_counters = MEM_calloc_arrayN( - sizeof(*ctx->accumulated_counters), num_vertices, "subdiv accumulated counters"); + num_vertices, sizeof(*ctx->accumulated_counters), "subdiv accumulated counters"); } static void subdiv_mesh_context_free(SubdivMeshContext *ctx) diff --git a/source/blender/blenkernel/intern/tracking_auto.c b/source/blender/blenkernel/intern/tracking_auto.c index 92ff0911cf3..e2a29d7858d 100644 --- a/source/blender/blenkernel/intern/tracking_auto.c +++ b/source/blender/blenkernel/intern/tracking_auto.c @@ -475,7 +475,7 @@ static void autotrack_context_init_autotrack(AutoTrackContext *context) /* Allocate memory for all the markers. */ libmv_Marker *libmv_markers = MEM_malloc_arrayN( - sizeof(libmv_Marker), num_trackable_markers, "libmv markers array"); + num_trackable_markers, sizeof(libmv_Marker), "libmv markers array"); /* Fill in markers array. */ int num_filled_libmv_markers = 0; @@ -516,7 +516,7 @@ static void autotrack_context_init_markers(AutoTrackContext *context) /* Allocate required memory. */ context->autotrack_markers = MEM_calloc_arrayN( - sizeof(AutoTrackMarker), context->num_autotrack_markers, "auto track options"); + context->num_autotrack_markers, sizeof(AutoTrackMarker), "auto track options"); /* Fill in all the markers. */ int autotrack_marker_index = 0; diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index f95619803bf..6c397fae836 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -230,8 +230,8 @@ EdgeHash *BLI_edgehash_new_ex(const char *info, const uint reserve) UPDATE_SLOT_MASK(eh); eh->length = 0; eh->dummy_count = 0; - eh->entries = MEM_calloc_arrayN(sizeof(EdgeHashEntry), ENTRIES_CAPACITY(eh), "eh entries"); - eh->map = MEM_malloc_arrayN(sizeof(int32_t), MAP_CAPACITY(eh), "eh map"); + eh->entries = MEM_calloc_arrayN(ENTRIES_CAPACITY(eh), sizeof(EdgeHashEntry), "eh entries"); + eh->map = MEM_malloc_arrayN(MAP_CAPACITY(eh), sizeof(int32_t), "eh map"); CLEAR_MAP(eh); return eh; } @@ -515,8 +515,8 @@ EdgeSet *BLI_edgeset_new_ex(const char *info, const uint reserve) es->capacity_exp = calc_capacity_exp_for_reserve(reserve); UPDATE_SLOT_MASK(es); es->length = 0; - es->entries = MEM_malloc_arrayN(sizeof(Edge), ENTRIES_CAPACITY(es), "es entries"); - es->map = MEM_malloc_arrayN(sizeof(int32_t), MAP_CAPACITY(es), "es map"); + es->entries = MEM_malloc_arrayN(ENTRIES_CAPACITY(es), sizeof(Edge), "es entries"); + es->map = MEM_malloc_arrayN(MAP_CAPACITY(es), sizeof(int32_t), "es map"); CLEAR_MAP(es); return es; } diff --git a/source/blender/draw/engines/eevee/eevee_cryptomatte.c b/source/blender/draw/engines/eevee/eevee_cryptomatte.c index ea60dd0753e..4c9ce9dbd65 100644 --- a/source/blender/draw/engines/eevee/eevee_cryptomatte.c +++ b/source/blender/draw/engines/eevee/eevee_cryptomatte.c @@ -164,12 +164,12 @@ void EEVEE_cryptomatte_output_init(EEVEE_ViewLayerData *UNUSED(sldata), if (g_data->cryptomatte_accum_buffer == NULL) { g_data->cryptomatte_accum_buffer = MEM_calloc_arrayN( - sizeof(EEVEE_CryptomatteSample), buffer_size * eevee_cryptomatte_pixel_stride(view_layer), + sizeof(EEVEE_CryptomatteSample), __func__); /* Download buffer should store a float per active cryptomatte layer. */ g_data->cryptomatte_download_buffer = MEM_malloc_arrayN( - sizeof(float), buffer_size * num_cryptomatte_layers, __func__); + buffer_size * num_cryptomatte_layers, sizeof(float), __func__); } else { /* During multiview rendering the `cryptomatte_accum_buffer` is deallocated after all views diff --git a/source/blender/editors/animation/anim_motion_paths.c b/source/blender/editors/animation/anim_motion_paths.c index d130941b9bc..0d812198d04 100644 --- a/source/blender/editors/animation/anim_motion_paths.c +++ b/source/blender/editors/animation/anim_motion_paths.c @@ -84,7 +84,7 @@ Depsgraph *animviz_depsgraph_build(Main *bmain, /* Make a flat array of IDs for the DEG API. */ const int num_ids = BLI_listbase_count(targets); - ID **ids = MEM_malloc_arrayN(sizeof(ID *), num_ids, "animviz IDS"); + ID **ids = MEM_malloc_arrayN(num_ids, sizeof(ID *), "animviz IDS"); int current_id_index = 0; for (MPathTarget *mpt = targets->first; mpt != NULL; mpt = mpt->next) { ids[current_id_index++] = &mpt->ob->id; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 95df8b69cd4..2c6b5cc594b 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -792,12 +792,12 @@ static float *setting_get_rna_values( int *tmp_int; if (length > buffer_size) { - values = MEM_malloc_arrayN(sizeof(float), length, __func__); + values = MEM_malloc_arrayN(length, sizeof(float), __func__); } switch (RNA_property_type(prop)) { case PROP_BOOLEAN: - tmp_bool = MEM_malloc_arrayN(sizeof(*tmp_bool), length, __func__); + tmp_bool = MEM_malloc_arrayN(length, sizeof(*tmp_bool), __func__); RNA_property_boolean_get_array(ptr, prop, tmp_bool); for (int i = 0; i < length; i++) { values[i] = (float)tmp_bool[i]; @@ -805,7 +805,7 @@ static float *setting_get_rna_values( MEM_freeN(tmp_bool); break; case PROP_INT: - tmp_int = MEM_malloc_arrayN(sizeof(*tmp_int), length, __func__); + tmp_int = MEM_malloc_arrayN(length, sizeof(*tmp_int), __func__); RNA_property_int_get_array(ptr, prop, tmp_int); for (int i = 0; i < length; i++) { values[i] = (float)tmp_int[i]; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 90b6db82838..f6012883e1f 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -3556,7 +3556,7 @@ static int gpencil_stroke_join_exec(bContext *C, wmOperator *op) int tot_strokes = 0; /** Alloc memory. */ - tJoinStrokes *strokes_list = MEM_malloc_arrayN(sizeof(tJoinStrokes), max_join_strokes, __func__); + tJoinStrokes *strokes_list = MEM_malloc_arrayN(max_join_strokes, sizeof(tJoinStrokes), __func__); tJoinStrokes *elem = NULL; /* Read all selected strokes to create a list. */ CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c index 40874375772..2ba03969f38 100644 --- a/source/blender/editors/sculpt_paint/sculpt_expand.c +++ b/source/blender/editors/sculpt_paint/sculpt_expand.c @@ -465,7 +465,7 @@ static float *sculpt_expand_topology_falloff_create(Sculpt *sd, Object *ob, cons { SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - float *dists = MEM_calloc_arrayN(sizeof(float), totvert, "topology dist"); + float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "topology dist"); SculptFloodFill flood; SCULPT_floodfill_init(ss, &flood); @@ -515,7 +515,7 @@ static float *sculpt_expand_normal_falloff_create(Sculpt *sd, { SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - float *dists = MEM_malloc_arrayN(sizeof(float), totvert, "normal dist"); + float *dists = MEM_malloc_arrayN(totvert, sizeof(float), "normal dist"); float *edge_factor = MEM_callocN(sizeof(float) * totvert, "mask edge factor"); for (int i = 0; i < totvert; i++) { edge_factor[i] = 1.0f; @@ -560,7 +560,7 @@ static float *sculpt_expand_spherical_falloff_create(Object *ob, const int v) SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - float *dists = MEM_malloc_arrayN(sizeof(float), totvert, "spherical dist"); + float *dists = MEM_malloc_arrayN(totvert, sizeof(float), "spherical dist"); for (int i = 0; i < totvert; i++) { dists[i] = FLT_MAX; } @@ -591,7 +591,7 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const i { SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - float *dists = MEM_calloc_arrayN(sizeof(float), totvert, "spherical dist"); + float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "spherical dist"); BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices"); GSQueue *queue = BLI_gsqueue_new(sizeof(int)); @@ -652,7 +652,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const int v) { SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - float *dists = MEM_calloc_arrayN(sizeof(float), totvert, "spherical dist"); + float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "spherical dist"); /* This algorithm uses mesh data (polys and loops), so this falloff type can't be initialized for * Multires. It also does not make sense to implement it for dyntopo as the result will be the @@ -863,7 +863,7 @@ static void sculpt_expand_topology_from_state_boundary(Object *ob, SculptSession *ss = ob->sculpt; const int totvert = SCULPT_vertex_count_get(ss); - float *dists = MEM_calloc_arrayN(sizeof(float), totvert, "topology dist"); + float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "topology dist"); BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false); SculptFloodFill flood; diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c index bdbdb75732a..89e07081802 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.c +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c @@ -1233,7 +1233,7 @@ static void sculpt_face_set_edit_fair_face_set(Object *ob, const int totvert = SCULPT_vertex_count_get(ss); Mesh *mesh = ob->data; - bool *fair_vertices = MEM_malloc_arrayN(sizeof(bool), totvert, "fair vertices"); + bool *fair_vertices = MEM_malloc_arrayN(totvert, sizeof(bool), "fair vertices"); SCULPT_boundary_info_ensure(ob); diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index 3fc1a7674f7..2a7c2a46818 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -511,7 +511,7 @@ static void mesh_filter_init_limit_surface_co(SculptSession *ss) FilterCache *filter_cache = ss->filter_cache; filter_cache->limit_surface_co = MEM_malloc_arrayN( - sizeof(float[3]), totvert, "limit surface co"); + totvert, sizeof(float[3]), "limit surface co"); for (int i = 0; i < totvert; i++) { SCULPT_vertex_limit_surface_get(ss, i, filter_cache->limit_surface_co[i]); } @@ -528,7 +528,7 @@ static void mesh_filter_sharpen_init(SculptSession *ss, filter_cache->sharpen_smooth_ratio = smooth_ratio; filter_cache->sharpen_intensify_detail_strength = intensify_detail_strength; filter_cache->sharpen_curvature_smooth_iterations = curvature_smooth_iterations; - filter_cache->sharpen_factor = MEM_malloc_arrayN(sizeof(float), totvert, "sharpen factor"); + filter_cache->sharpen_factor = MEM_malloc_arrayN(totvert, sizeof(float), "sharpen factor"); filter_cache->detail_directions = MEM_malloc_arrayN( totvert, sizeof(float[3]), "sharpen detail direction"); diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index 24d0d39292e..34d2260d35b 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -1546,9 +1546,9 @@ DNA_ReconstructInfo *DNA_reconstruct_info_create(const SDNA *oldsdna, reconstruct_info->oldsdna = oldsdna; reconstruct_info->newsdna = newsdna; reconstruct_info->compare_flags = compare_flags; - reconstruct_info->step_counts = MEM_malloc_arrayN(sizeof(int), newsdna->structs_len, __func__); + reconstruct_info->step_counts = MEM_malloc_arrayN(newsdna->structs_len, sizeof(int), __func__); reconstruct_info->steps = MEM_malloc_arrayN( - sizeof(ReconstructStep *), newsdna->structs_len, __func__); + newsdna->structs_len, sizeof(ReconstructStep *), __func__); /* Generate reconstruct steps for all structs. */ for (int new_struct_nr = 0; new_struct_nr < newsdna->structs_len; new_struct_nr++) { diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 9d8ed161738..c7a1c89af63 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -541,7 +541,7 @@ static void rna_ShapeKey_data_begin_mixed(CollectionPropertyIterator *iter, int point_count = rna_ShapeKey_curve_find_index(key, kb->totelem); ShapeKeyCurvePoint *points = MEM_malloc_arrayN( - sizeof(ShapeKeyCurvePoint), point_count, __func__); + point_count, sizeof(ShapeKeyCurvePoint), __func__); char *databuf = kb->data; int items_left = point_count; |