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/blender/editors | |
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/blender/editors')
6 files changed, 14 insertions, 14 deletions
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"); |