[Bf-blender-cvs] [494a6a0bf2c] master: Cleanup: `layer_collection_sync`: use `LISTBASE_FOREACH_MUTABLE`.

Bastien Montagne noreply at git.blender.org
Tue Jul 21 12:25:44 CEST 2020


Commit: 494a6a0bf2c9141251d7dbae9dc51acd42ebc702
Author: Bastien Montagne
Date:   Tue Jul 21 12:17:22 2020 +0200
Branches: master
https://developer.blender.org/rB494a6a0bf2c9141251d7dbae9dc51acd42ebc702

Cleanup: `layer_collection_sync`: use `LISTBASE_FOREACH_MUTABLE`.

===================================================================

M	source/blender/blenkernel/intern/layer.c

===================================================================

diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 5bedc86f25d..64649d84320 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -708,9 +708,8 @@ static void layer_collection_sync(ViewLayer *view_layer,
    * linking we can only sync after the fact. */
 
   /* Remove layer collections that no longer have a corresponding scene collection. */
-  for (LayerCollection *lc = lb_layer_collections->first; lc;) {
-    /* Note ID remap can set lc->collection to NULL when deleting collections. */
-    LayerCollection *lc_next = lc->next;
+  LISTBASE_FOREACH_MUTABLE (LayerCollection *, lc, lb_layer_collections) {
+    /* Note that ID remap can set lc->collection to NULL when deleting collections. */
     Collection *collection = (lc->collection) ?
                                  BLI_findptr(lb_collections,
                                              lc->collection,
@@ -726,8 +725,6 @@ static void layer_collection_sync(ViewLayer *view_layer,
       layer_collection_free(view_layer, lc);
       BLI_freelinkN(lb_layer_collections, lc);
     }
-
-    lc = lc_next;
   }
 
   /* Add layer collections for any new scene collections, and ensure order is the same. */



More information about the Bf-blender-cvs mailing list