[Bf-blender-cvs] [fd2bf32dc7d] master: Cleanup: use memset instead of clearing individual runtime members

Campbell Barton noreply at git.blender.org
Wed Jan 18 04:19:29 CET 2023


Commit: fd2bf32dc7d15d34dc1b99dae1a8605f25db1951
Author: Campbell Barton
Date:   Wed Jan 18 14:10:29 2023 +1100
Branches: master
https://developer.blender.org/rBfd2bf32dc7d15d34dc1b99dae1a8605f25db1951

Cleanup: use memset instead of clearing individual runtime members

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

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

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

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 1ca870bd397..621d8e5df8e 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -209,10 +209,8 @@ static void collection_blend_write(BlendWriter *writer, ID *id, const void *id_a
   /* Clean up, important in undo case to reduce false detection of changed data-blocks. */
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-  collection->runtime.tag = 0;
-  BLI_listbase_clear(&collection->runtime.object_cache);
-  BLI_listbase_clear(&collection->runtime.object_cache_instanced);
-  BLI_listbase_clear(&collection->runtime.parents);
+
+  memset(&collection->runtime, 0, sizeof(collection->runtime));
 
   /* write LibData */
   BLO_write_id_struct(writer, Collection, id_address, &collection->id);
@@ -259,6 +257,8 @@ void BKE_collection_blend_read_data(BlendDataReader *reader, Collection *collect
     }
     collection->id.flag |= LIB_EMBEDDED_DATA;
   }
+
+  memset(&collection->runtime, 0, sizeof(collection->runtime));
   collection->runtime.owner_id = owner_id;
 
   BLO_read_list(reader, &collection->gobject);
@@ -269,10 +269,6 @@ void BKE_collection_blend_read_data(BlendDataReader *reader, Collection *collect
 
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE;
   collection->flag &= ~COLLECTION_HAS_OBJECT_CACHE_INSTANCED;
-  collection->runtime.tag = 0;
-  BLI_listbase_clear(&collection->runtime.object_cache);
-  BLI_listbase_clear(&collection->runtime.object_cache_instanced);
-  BLI_listbase_clear(&collection->runtime.parents);
 
 #ifdef USE_COLLECTION_COMPAT_28
   /* This runs before the very first doversion. */



More information about the Bf-blender-cvs mailing list