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 <campbell@blender.org>2022-02-20 13:28:57 +0300
committerCampbell Barton <campbell@blender.org>2022-02-21 04:01:32 +0300
commite93a8c4f74d854b6e2b42cb10651333faed8f280 (patch)
tree3738e4fe054f7f696684d38bc69964be00d3627c /source/blender/bmesh/intern
parent626fb290eb43eb43b9451c757b1e906f0b5eeb53 (diff)
Cleanup: avoid reallocating arrays at the same size
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index 45a42c29d84..1bc5b70f874 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -2234,7 +2234,9 @@ int BM_mesh_calc_face_groups(BMesh *bm,
MEM_freeN(stack);
/* reduce alloc to required size */
- group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_curr);
+ if (group_index_len != group_curr) {
+ group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_curr);
+ }
*r_group_index = group_index;
return group_curr;
@@ -2354,7 +2356,9 @@ int BM_mesh_calc_edge_groups(BMesh *bm,
MEM_freeN(stack);
/* reduce alloc to required size */
- group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_curr);
+ if (group_index_len != group_curr) {
+ group_index = MEM_reallocN(group_index, sizeof(*group_index) * group_curr);
+ }
*r_group_index = group_index;
return group_curr;