[Bf-blender-cvs] [b0d565e5b60] master: Cleanup: reduce scope of variables in custom data copying

Campbell Barton noreply at git.blender.org
Wed Apr 8 08:47:18 CEST 2020


Commit: b0d565e5b60c987b2e9aa6a438704a57e93412c3
Author: Campbell Barton
Date:   Wed Apr 8 16:27:59 2020 +1000
Branches: master
https://developer.blender.org/rBb0d565e5b60c987b2e9aa6a438704a57e93412c3

Cleanup: reduce scope of variables in custom data copying

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

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

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

diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 87a5ac80bc7..754c2ce097f 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -3556,10 +3556,9 @@ void CustomData_bmesh_copy_data_exclude_by_type(const CustomData *source,
     /* if we found a matching layer, copy the data */
     if (dest->layers[dest_i].type == source->layers[src_i].type &&
         STREQ(dest->layers[dest_i].name, source->layers[src_i].name)) {
-      const void *src_data = POINTER_OFFSET(src_block, source->layers[src_i].offset);
-      void *dest_data = POINTER_OFFSET(*dest_block, dest->layers[dest_i].offset);
-
       if (no_mask || ((CD_TYPE_AS_MASK(dest->layers[dest_i].type) & mask_exclude) == 0)) {
+        const void *src_data = POINTER_OFFSET(src_block, source->layers[src_i].offset);
+        void *dest_data = POINTER_OFFSET(*dest_block, dest->layers[dest_i].offset);
         const LayerTypeInfo *typeInfo = layerType_getInfo(source->layers[src_i].type);
         if (typeInfo->copy) {
           typeInfo->copy(src_data, dest_data, 1);



More information about the Bf-blender-cvs mailing list