diff options
author | Bastien Montagne <bastien@blender.org> | 2021-04-08 12:22:47 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-04-08 12:45:44 +0300 |
commit | c1b1ed4d5b2f90b48296055e817fded0f8ee8f38 (patch) | |
tree | f1743978770bb8b5a61c106253109a574bcc6349 /source/blender/blenkernel/intern/collection.c | |
parent | 14d74fb34174a91190d35d7fe595f8dd64cb79d1 (diff) |
Minor cleanup to `scene_collection_array`.
Use array allocation, and remove useless check.
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 426f8a44aff..8e4633cbe15 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -2015,12 +2015,10 @@ static void scene_collections_array(Scene *scene, BLI_assert(collection != NULL); scene_collection_callback(collection, scene_collections_count, r_collections_array_len); - if (*r_collections_array_len == 0) { - return; - } + BLI_assert(*r_collections_array_len > 0); - Collection **array = MEM_mallocN(sizeof(Collection *) * (*r_collections_array_len), - "CollectionArray"); + Collection **array = MEM_malloc_arrayN( + *r_collections_array_len, sizeof(Collection *), "CollectionArray"); *r_collections_array = array; scene_collection_callback(collection, scene_collections_build_array, &array); } |